DataGridColumnStyle DataGridColumnStyle DataGridColumnStyle DataGridColumnStyle Class

Definition

Gibt die Darstellung, die Textformatierung und das Verhalten einer DataGrid-Steuerelementspalte an.Specifies the appearance, text formatting, and behavior of a DataGrid control column. Diese Klasse ist abstrakt.This class is abstract.

public ref class DataGridColumnStyle abstract : System::ComponentModel::Component, System::Windows::Forms::IDataGridColumnStyleEditingNotificationService
public abstract class DataGridColumnStyle : System.ComponentModel.Component, System.Windows.Forms.IDataGridColumnStyleEditingNotificationService
type DataGridColumnStyle = class
    inherit Component
    interface IDataGridColumnStyleEditingNotificationService
Public MustInherit Class DataGridColumnStyle
Inherits Component
Implements IDataGridColumnStyleEditingNotificationService
Vererbung
Abgeleitet
Implementiert

Beispiele

Das folgende Codebeispiel erstellt eine DataGridColumnStyle , hostet einen DateTimePicker Steuerelement.The following code example creates a DataGridColumnStyle that hosts a DateTimePicker control.

#using <System.dll>
#using <System.Data.dll>
#using <System.Drawing.dll>
#using <System.Windows.Forms.dll>
#using <System.Xml.dll>

using namespace System;
using namespace System::Data;
using namespace System::Windows::Forms;
using namespace System::Drawing;
using namespace System::Security::Permissions;

// This example shows how to create your own column style that
// hosts a control, in this case, a DateTimePicker.

public ref class CustomDateTimePicker : public DateTimePicker
{
protected:
    [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)]
    virtual bool ProcessKeyMessage( Message% m ) override
    {
        // Keep all the keys for the DateTimePicker.
        return ProcessKeyEventArgs( m );
    }
};

public ref class DataGridTimePickerColumn : public DataGridColumnStyle
{
private:
   CustomDateTimePicker^ customDateTimePicker1;

   // The isEditing field tracks whether or not the user is
   // editing data with the hosted control.
   bool isEditing;

public:
   DataGridTimePickerColumn()
   {
      customDateTimePicker1 = gcnew CustomDateTimePicker;
      customDateTimePicker1->Visible = false;
   }

protected:
   virtual void Abort( int /*rowNum*/ ) override
   {
      isEditing = false;
      customDateTimePicker1->ValueChanged -=
         gcnew EventHandler( this, &DataGridTimePickerColumn::TimePickerValueChanged );
      Invalidate();
   }

   virtual bool Commit( CurrencyManager^ dataSource, int rowNum ) override
   {
      customDateTimePicker1->Bounds = Rectangle::Empty;

      customDateTimePicker1->ValueChanged -=
         gcnew EventHandler( this, &DataGridTimePickerColumn::TimePickerValueChanged );
      
      if (  !isEditing )
         return true;

      isEditing = false;

      try
      {
         DateTime value = customDateTimePicker1->Value;
         SetColumnValueAtRow( dataSource, rowNum, value );
      }
      catch ( Exception^ ) 
      {
         Abort( rowNum );
         return false;
      }

      Invalidate();
      return true;
   }

   virtual void Edit(
      CurrencyManager^ source,
      int rowNum,
      Rectangle bounds,
      bool /*readOnly*/,
      String^ /*displayText*/,
      bool cellIsVisible ) override
   {
      DateTime value =  (DateTime)
         GetColumnValueAtRow( source, rowNum );
      if ( cellIsVisible )
      {
         customDateTimePicker1->Bounds = Rectangle(
            bounds.X + 2, bounds.Y + 2,
            bounds.Width - 4, bounds.Height - 4 );
         customDateTimePicker1->Value = value;
         customDateTimePicker1->Visible = true;
         customDateTimePicker1->ValueChanged +=
            gcnew EventHandler( this, &DataGridTimePickerColumn::TimePickerValueChanged );
      }
      else
      {
         customDateTimePicker1->Value = value;
         customDateTimePicker1->Visible = false;
      }

      if ( customDateTimePicker1->Visible )
         DataGridTableStyle->DataGrid->Invalidate( bounds );

      customDateTimePicker1->Focus();
   }

   virtual System::Drawing::Size GetPreferredSize(
      Graphics^ /*g*/,
      Object^ /*value*/ ) override
   {
      return Size( 100, customDateTimePicker1->PreferredHeight + 4);
   }

   virtual int GetMinimumHeight() override
   {
      return customDateTimePicker1->PreferredHeight + 4;
   }

   virtual int GetPreferredHeight( Graphics^ /*g*/,
      Object^ /*value*/ ) override
   {
      return customDateTimePicker1->PreferredHeight + 4;
   }

   virtual void Paint( Graphics^ g,
      Rectangle bounds,
      CurrencyManager^ source,
      int rowNum ) override
   {
      Paint( g, bounds, source, rowNum, false );
   }

   virtual void Paint(
      Graphics^ g,
      Rectangle bounds,
      CurrencyManager^ source,
      int rowNum,
      bool alignToRight ) override
   {
      Paint(
         g, bounds,
         source,
         rowNum,
         Brushes::Red,
         Brushes::Blue,
         alignToRight );
   }

   virtual void Paint(
      Graphics^ g,
      Rectangle bounds,
      CurrencyManager^ source,
      int rowNum,
      Brush^ backBrush,
      Brush^ foreBrush,
      bool /*alignToRight*/ ) override
   {
      DateTime date =  (DateTime)
         GetColumnValueAtRow( source, rowNum );
      Rectangle rect = bounds;
      g->FillRectangle( backBrush, rect );
      rect.Offset( 0, 2 );
      rect.Height -= 2;
      g->DrawString( date.ToString( "d" ),
         this->DataGridTableStyle->DataGrid->Font,
         foreBrush, rect );
   }

   virtual void SetDataGridInColumn( DataGrid^ value ) override
   {
      DataGridColumnStyle::SetDataGridInColumn( value );
      if ( customDateTimePicker1->Parent != nullptr )
      {
         customDateTimePicker1->Parent->Controls->Remove
            ( customDateTimePicker1 );
      }
      if ( value != nullptr )
      {
         value->Controls->Add( customDateTimePicker1 );
      }
   }

private:
   void TimePickerValueChanged( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      // Remove the handler to prevent it from being called twice in a row.
      customDateTimePicker1->ValueChanged -=
         gcnew EventHandler( this, &DataGridTimePickerColumn::TimePickerValueChanged );
      this->isEditing = true;
      DataGridColumnStyle::ColumnStartedEditing( customDateTimePicker1 );
   }
};

public ref class MyForm: public Form
{
private:
   DataTable^ namesDataTable;
   DataGrid^ grid;
public:
   MyForm()
   {
      grid = gcnew DataGrid;

      InitForm();

      namesDataTable = gcnew DataTable( "NamesTable" );
      namesDataTable->Columns->Add( gcnew DataColumn( "Name" ) );
      DataColumn^ dateColumn = gcnew DataColumn
         ( "Date",DateTime::typeid );
      dateColumn->DefaultValue = DateTime::Today;
      namesDataTable->Columns->Add( dateColumn );
      DataSet^ namesDataSet = gcnew DataSet;
      namesDataSet->Tables->Add( namesDataTable );
      grid->DataSource = namesDataSet;
      grid->DataMember = "NamesTable";
      AddGridStyle();
      AddData();
   }

private:
   void AddGridStyle()
   {
      DataGridTableStyle^ myGridStyle = gcnew DataGridTableStyle;
      myGridStyle->MappingName = "NamesTable";
      DataGridTextBoxColumn^ nameColumnStyle =
         gcnew DataGridTextBoxColumn;
      nameColumnStyle->MappingName = "Name";
      nameColumnStyle->HeaderText = "Name";
      myGridStyle->GridColumnStyles->Add( nameColumnStyle );

      DataGridTimePickerColumn^ timePickerColumnStyle =
         gcnew DataGridTimePickerColumn;
      timePickerColumnStyle->MappingName = "Date";
      timePickerColumnStyle->HeaderText = "Date";
      timePickerColumnStyle->Width = 100;
      myGridStyle->GridColumnStyles->Add( timePickerColumnStyle );

      grid->TableStyles->Add( myGridStyle );
   }

   void AddData()
   {
      DataRow^ dRow = namesDataTable->NewRow();
      dRow->default[ "Name" ] = "Name 1";
      dRow->default[ "Date" ] = DateTime(2001,12,01);
      namesDataTable->Rows->Add( dRow );

      dRow = namesDataTable->NewRow();
      dRow->default[ "Name" ] = "Name 2";
      dRow->default[ "Date" ] = DateTime(2001,12,04);
      namesDataTable->Rows->Add( dRow );

      dRow = namesDataTable->NewRow();
      dRow->default[ "Name" ] = "Name 3";
      dRow->default[ "Date" ] = DateTime(2001,12,29);
      namesDataTable->Rows->Add( dRow );

      dRow = namesDataTable->NewRow();
      dRow->default[ "Name" ] = "Name 4";
      dRow->default[ "Date" ] = DateTime(2001,12,13);
      namesDataTable->Rows->Add( dRow );

      dRow = namesDataTable->NewRow();
      dRow->default[ "Name" ] = "Name 5";
      dRow->default[ "Date" ] = DateTime(2001,12,21);
      namesDataTable->Rows->Add( dRow );

      namesDataTable->AcceptChanges();
   }

   void InitForm()
   {
      this->Size = System::Drawing::Size( 500, 500 );
      grid->Size = System::Drawing::Size( 350, 250 );
      grid->TabStop = true;
      grid->TabIndex = 1;
      this->StartPosition = FormStartPosition::CenterScreen;
      this->Controls->Add( grid );
   }
};

[STAThread]
int main()
{
   Application::Run( gcnew MyForm );
}
using System;
using System.Data;
using System.Windows.Forms;
using System.Drawing;
using System.Security.Permissions;

// This example shows how to create your own column style that
// hosts a control, in this case, a DateTimePicker.
public class DataGridTimePickerColumn : DataGridColumnStyle
{
    private CustomDateTimePicker customDateTimePicker1 = 
        new CustomDateTimePicker();

    // The isEditing field tracks whether or not the user is
    // editing data with the hosted control.
    private bool isEditing;

    public DataGridTimePickerColumn() : base()
    {
        customDateTimePicker1.Visible = false;
    }

    protected override void Abort(int rowNum)
    {
        isEditing = false;
        customDateTimePicker1.ValueChanged -=
            new EventHandler(TimePickerValueChanged);
        Invalidate();
    }

    protected override bool Commit
        (CurrencyManager dataSource, int rowNum)
    {
        customDateTimePicker1.Bounds = Rectangle.Empty;

        customDateTimePicker1.ValueChanged -=
            new EventHandler(TimePickerValueChanged);

        if (!isEditing)
            return true;

        isEditing = false;

        try
        {
            DateTime value = customDateTimePicker1.Value;
            SetColumnValueAtRow(dataSource, rowNum, value);
        }
        catch (Exception)
        {
            Abort(rowNum);
            return false;
        }

        Invalidate();
        return true;
    }

    protected override void Edit(
        CurrencyManager source,
        int rowNum,
        Rectangle bounds,
        bool readOnly,
        string displayText,
        bool cellIsVisible)
    {
        DateTime value = (DateTime)
            GetColumnValueAtRow(source, rowNum);
        if (cellIsVisible)
        {
            customDateTimePicker1.Bounds = new Rectangle
                (bounds.X + 2, bounds.Y + 2,
                bounds.Width - 4, bounds.Height - 4);
            customDateTimePicker1.Value = value;
            customDateTimePicker1.Visible = true;
            customDateTimePicker1.ValueChanged +=
                new EventHandler(TimePickerValueChanged);
        }
        else
        {
            customDateTimePicker1.Value = value;
            customDateTimePicker1.Visible = false;
        }

        if (customDateTimePicker1.Visible)
            DataGridTableStyle.DataGrid.Invalidate(bounds);

        customDateTimePicker1.Focus();
    }

    protected override Size GetPreferredSize(
        Graphics g,
        object value)
    {
        return new Size(100, customDateTimePicker1.PreferredHeight + 4);
    }

    protected override int GetMinimumHeight()
    {
        return customDateTimePicker1.PreferredHeight + 4;
    }

    protected override int GetPreferredHeight(Graphics g,
        object value)
    {
        return customDateTimePicker1.PreferredHeight + 4;
    }

    protected override void Paint(Graphics g,
        Rectangle bounds,
        CurrencyManager source,
        int rowNum)
    {
        Paint(g, bounds, source, rowNum, false);
    }

    protected override void Paint(
        Graphics g,
        Rectangle bounds,
        CurrencyManager source,
        int rowNum,
        bool alignToRight)
    {
        Paint(
            g, bounds,
            source,
            rowNum,
            Brushes.Red,
            Brushes.Blue,
            alignToRight);
    }

    protected override void Paint(
        Graphics g,
        Rectangle bounds,
        CurrencyManager source,
        int rowNum,
        Brush backBrush,
        Brush foreBrush,
        bool alignToRight)
    {
        DateTime date = (DateTime)
            GetColumnValueAtRow(source, rowNum);
        Rectangle rect = bounds;
        g.FillRectangle(backBrush, rect);
        rect.Offset(0, 2);
        rect.Height -= 2;
        g.DrawString(date.ToString("d"),
            this.DataGridTableStyle.DataGrid.Font,
            foreBrush, rect);
    }

    protected override void SetDataGridInColumn(DataGrid value)
    {
        base.SetDataGridInColumn(value);
        if (customDateTimePicker1.Parent != null)
        {
            customDateTimePicker1.Parent.Controls.Remove
                (customDateTimePicker1);
        }
        if (value != null)
        {
            value.Controls.Add(customDateTimePicker1);
        }
    }

    private void TimePickerValueChanged(object sender, EventArgs e)
    {
        // Remove the handler to prevent it from being called twice in a row.
        customDateTimePicker1.ValueChanged -=
            new EventHandler(TimePickerValueChanged);
        this.isEditing = true;
        base.ColumnStartedEditing(customDateTimePicker1);
    }
}

public class CustomDateTimePicker : DateTimePicker
{
    [SecurityPermissionAttribute(
    SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.UnmanagedCode)]
    protected override bool ProcessKeyMessage(ref Message m)
    {
        // Keep all the keys for the DateTimePicker.
        return ProcessKeyEventArgs(ref m);
    }
}

public class MyForm : Form
{
    private DataTable namesDataTable;
    private DataGrid grid = new DataGrid();
    public MyForm() : base()
    {
        InitForm();

        namesDataTable = new DataTable("NamesTable");
        namesDataTable.Columns.Add(new DataColumn("Name"));
        DataColumn dateColumn = new DataColumn
            ("Date", typeof(DateTime));
        dateColumn.DefaultValue = DateTime.Today;
        namesDataTable.Columns.Add(dateColumn);
        DataSet namesDataSet = new DataSet();
        namesDataSet.Tables.Add(namesDataTable);
        grid.DataSource = namesDataSet;
        grid.DataMember = "NamesTable";
        AddGridStyle();
        AddData();
    }

    private void AddGridStyle()
    {
        DataGridTableStyle myGridStyle = new DataGridTableStyle();
        myGridStyle.MappingName = "NamesTable";

        DataGridTextBoxColumn nameColumnStyle =
            new DataGridTextBoxColumn();
        nameColumnStyle.MappingName = "Name";
        nameColumnStyle.HeaderText = "Name";
        myGridStyle.GridColumnStyles.Add(nameColumnStyle);

        DataGridTimePickerColumn timePickerColumnStyle =
            new DataGridTimePickerColumn();
        timePickerColumnStyle.MappingName = "Date";
        timePickerColumnStyle.HeaderText = "Date";
        timePickerColumnStyle.Width = 100;
        myGridStyle.GridColumnStyles.Add(timePickerColumnStyle);

        grid.TableStyles.Add(myGridStyle);
    }

    private void AddData()
    {

        DataRow dRow = namesDataTable.NewRow();
        dRow["Name"] = "Name 1";
        dRow["Date"] = new DateTime(2001, 12, 01);
        namesDataTable.Rows.Add(dRow);

        dRow = namesDataTable.NewRow();
        dRow["Name"] = "Name 2";
        dRow["Date"] = new DateTime(2001, 12, 04);
        namesDataTable.Rows.Add(dRow);

        dRow = namesDataTable.NewRow();
        dRow["Name"] = "Name 3";
        dRow["Date"] = new DateTime(2001, 12, 29);
        namesDataTable.Rows.Add(dRow);

        dRow = namesDataTable.NewRow();
        dRow["Name"] = "Name 4";
        dRow["Date"] = new DateTime(2001, 12, 13);
        namesDataTable.Rows.Add(dRow);

        dRow = namesDataTable.NewRow();
        dRow["Name"] = "Name 5";
        dRow["Date"] = new DateTime(2001, 12, 21);
        namesDataTable.Rows.Add(dRow);

        namesDataTable.AcceptChanges();
    }

    private void InitForm()
    {
        this.Size = new Size(500, 500);
        grid.Size = new Size(350, 250);
        grid.TabStop = true;
        grid.TabIndex = 1;
        this.StartPosition = FormStartPosition.CenterScreen;
        this.Controls.Add(grid);
    }
 
    [STAThread]
    public static void Main()
    {
        Application.Run(new MyForm());
    }
}
Imports System
Imports System.Data
Imports System.Windows.Forms
Imports System.Drawing
Imports System.ComponentModel
Imports System.Security.Permissions

' This example shows how to create your own column style that
' hosts a control, in this case, a DateTimePicker.
Public Class DataGridTimePickerColumn
    Inherits DataGridColumnStyle

    Private customDateTimePicker1 As New CustomDateTimePicker()

    ' The isEditing field tracks whether or not the user is
    ' editing data with the hosted control.
    Private isEditing As Boolean

    Public Sub New()
        customDateTimePicker1.Visible = False
    End Sub

    Protected Overrides Sub Abort(ByVal rowNum As Integer)
        isEditing = False
        RemoveHandler customDateTimePicker1.ValueChanged, _
            AddressOf TimePickerValueChanged
        Invalidate()
    End Sub

    Protected Overrides Function Commit _
        (ByVal dataSource As CurrencyManager, ByVal rowNum As Integer) _
        As Boolean

        customDateTimePicker1.Bounds = Rectangle.Empty

        RemoveHandler customDateTimePicker1.ValueChanged, _
            AddressOf TimePickerValueChanged

        If Not isEditing Then
            Return True
        End If
        isEditing = False

        Try
            Dim value As DateTime = customDateTimePicker1.Value
            SetColumnValueAtRow(dataSource, rowNum, value)
        Catch
        End Try

        Invalidate()
        Return True
    End Function

    Protected Overloads Overrides Sub Edit( _
        ByVal [source] As CurrencyManager, _
        ByVal rowNum As Integer, _
        ByVal bounds As Rectangle, _
        ByVal [readOnly] As Boolean, _
        ByVal displayText As String, _
        ByVal cellIsVisible As Boolean)

        Dim value As DateTime = _
        CType(GetColumnValueAtRow([source], rowNum), DateTime)
        If cellIsVisible Then
            customDateTimePicker1.Bounds = New Rectangle _
            (bounds.X + 2, bounds.Y + 2, bounds.Width - 4, _
            bounds.Height - 4)

            customDateTimePicker1.Value = value
            customDateTimePicker1.Visible = True
            AddHandler customDateTimePicker1.ValueChanged, _
            AddressOf TimePickerValueChanged
        Else
            customDateTimePicker1.Value = value
            customDateTimePicker1.Visible = False
        End If

        If customDateTimePicker1.Visible Then
            DataGridTableStyle.DataGrid.Invalidate(bounds)
        End If

        customDateTimePicker1.Focus()

    End Sub

    Protected Overrides Function GetPreferredSize( _
        ByVal g As Graphics, _
        ByVal value As Object) As Size

        Return New Size(100, customDateTimePicker1.PreferredHeight + 4)

    End Function

    Protected Overrides Function GetMinimumHeight() As Integer
        Return customDateTimePicker1.PreferredHeight + 4
    End Function

    Protected Overrides Function GetPreferredHeight( _
        ByVal g As Graphics, ByVal value As Object) As Integer

        Return customDateTimePicker1.PreferredHeight + 4

    End Function

    Protected Overloads Overrides Sub Paint( _
        ByVal g As Graphics, ByVal bounds As Rectangle, _
        ByVal [source] As CurrencyManager, ByVal rowNum As Integer)

        Paint(g, bounds, [source], rowNum, False)

    End Sub

    Protected Overloads Overrides Sub Paint(ByVal g As Graphics, _
        ByVal bounds As Rectangle, ByVal [source] As CurrencyManager, _
        ByVal rowNum As Integer, ByVal alignToRight As Boolean)

        Paint(g, bounds, [source], rowNum, Brushes.Red, _
            Brushes.Blue, alignToRight)

    End Sub

    Protected Overloads Overrides Sub Paint(ByVal g As Graphics, _
        ByVal bounds As Rectangle, ByVal [source] As CurrencyManager, _
        ByVal rowNum As Integer, ByVal backBrush As Brush, _
        ByVal foreBrush As Brush, ByVal alignToRight As Boolean)

        Dim [date] As DateTime = _
        CType(GetColumnValueAtRow([source], rowNum), DateTime)
        Dim rect As Rectangle = bounds
        g.FillRectangle(backBrush, rect)
        rect.Offset(0, 2)
        rect.Height -= 2
        g.DrawString([date].ToString("d"), _
            Me.DataGridTableStyle.DataGrid.Font, foreBrush, _
            RectangleF.FromLTRB(rect.X, rect.Y, rect.Right, rect.Bottom))

    End Sub

    Protected Overrides Sub SetDataGridInColumn(ByVal value As DataGrid)
        MyBase.SetDataGridInColumn(value)
        If (customDateTimePicker1.Parent IsNot Nothing) Then
            customDateTimePicker1.Parent.Controls.Remove(customDateTimePicker1)
        End If
        If (value IsNot Nothing) Then
            value.Controls.Add(customDateTimePicker1)
        End If
    End Sub

    Private Sub TimePickerValueChanged( _
        ByVal sender As Object, ByVal e As EventArgs)

        ' Remove the handler to prevent it from being called twice in a row.
        RemoveHandler customDateTimePicker1.ValueChanged, _
            AddressOf TimePickerValueChanged
        Me.isEditing = True
        MyBase.ColumnStartedEditing(customDateTimePicker1)

    End Sub

End Class

Public Class CustomDateTimePicker
    Inherits DateTimePicker

    <SecurityPermissionAttribute( _
    SecurityAction.LinkDemand, Flags := SecurityPermissionFlag.UnmanagedCode)> _
    Protected Overrides Function ProcessKeyMessage(ByRef m As Message) As Boolean
        ' Keep all the keys for the DateTimePicker.
        Return ProcessKeyEventArgs(m)
    End Function

End Class

Public Class MyForm
    Inherits Form

    Private namesDataTable As DataTable
    Private myGrid As DataGrid = New DataGrid()

    Public Sub New()

        InitForm()

        namesDataTable = New DataTable("NamesTable")
        namesDataTable.Columns.Add(New DataColumn("Name"))
        Dim dateColumn As DataColumn = _
             New DataColumn("Date", GetType(DateTime))
        dateColumn.DefaultValue = DateTime.Today
        namesDataTable.Columns.Add(dateColumn)
        Dim namesDataSet As DataSet = New DataSet()
        namesDataSet.Tables.Add(namesDataTable)
        myGrid.DataSource = namesDataSet
        myGrid.DataMember = "NamesTable"
        AddGridStyle()
        AddData()

    End Sub

    Private Sub AddGridStyle()
        Dim myGridStyle As DataGridTableStyle = _
                    New DataGridTableStyle()
        myGridStyle.MappingName = "NamesTable"

        Dim nameColumnStyle As DataGridTextBoxColumn = _
            New DataGridTextBoxColumn()
        nameColumnStyle.MappingName = "Name"
        nameColumnStyle.HeaderText = "Name"
        myGridStyle.GridColumnStyles.Add(nameColumnStyle)

        Dim customDateTimePicker1ColumnStyle As DataGridTimePickerColumn = _
            New DataGridTimePickerColumn()
        customDateTimePicker1ColumnStyle.MappingName = "Date"
        customDateTimePicker1ColumnStyle.HeaderText = "Date"
        customDateTimePicker1ColumnStyle.Width = 100
        myGridStyle.GridColumnStyles.Add(customDateTimePicker1ColumnStyle)

        myGrid.TableStyles.Add(myGridStyle)
    End Sub

    Private Sub AddData()
        Dim dRow As DataRow = namesDataTable.NewRow()
        dRow("Name") = "Name 1"
        dRow("Date") = New DateTime(2001, 12, 1)
        namesDataTable.Rows.Add(dRow)

        dRow = namesDataTable.NewRow()
        dRow("Name") = "Name 2"
        dRow("Date") = New DateTime(2001, 12, 4)
        namesDataTable.Rows.Add(dRow)

        dRow = namesDataTable.NewRow()
        dRow("Name") = "Name 3"
        dRow("Date") = New DateTime(2001, 12, 29)
        namesDataTable.Rows.Add(dRow)

        dRow = namesDataTable.NewRow()
        dRow("Name") = "Name 4"
        dRow("Date") = New DateTime(2001, 12, 13)
        namesDataTable.Rows.Add(dRow)

        dRow = namesDataTable.NewRow()
        dRow("Name") = "Name 5"
        dRow("Date") = New DateTime(2001, 12, 21)
        namesDataTable.Rows.Add(dRow)

        namesDataTable.AcceptChanges()
    End Sub

    Private Sub InitForm()
        Me.Size = New Size(500, 500)
        myGrid.Size = New Size(350, 250)
        myGrid.TabStop = True
        myGrid.TabIndex = 1
        Me.StartPosition = FormStartPosition.CenterScreen
        Me.Controls.Add(myGrid)
    End Sub

    <STAThread()> _
    Public Shared Sub Main()
        Application.Run(New MyForm())
    End Sub

End Class

Hinweise

Die Auflistung der DataGridColumnStyle Objekte (die GridColumnStylesCollection) erfolgt über die System.Windows.Forms.DataGrid des Steuerelements TableStyles Eigenschaft.The collection of DataGridColumnStyle objects (the GridColumnStylesCollection) is accessed through the System.Windows.Forms.DataGrid control's TableStyles property.

Die System.Windows.Forms.DataGrid -Steuerelement erstellt automatisch eine Auflistung von DataGridColumnStyle Objekte auf, wenn Sie festlegen, die DataSource Eigenschaft, um eine entsprechende Datenquelle.The System.Windows.Forms.DataGrid control automatically creates a collection of DataGridColumnStyle objects for you when you set the DataSource property to an appropriate data source. Die erstellten Objekten handelt es sich um Instanzen einer der folgenden Klassen, die von erben DataGridColumnStyle: DataGridBoolColumn oder DataGridTextBoxColumn Klasse.The objects created actually are instances of one of the following classes that inherit from DataGridColumnStyle: DataGridBoolColumn or DataGridTextBoxColumn class.

Um die Datenanzeige zu formatieren, legen die Format Eigenschaft der DataGridTextBoxColumn Klasse, um die Formatierung Werte.To format the data display, set the Format property of the DataGridTextBoxColumn class to one of the formatting values. Weitere Informationen über gültige Formatierungswerte finden Sie unter Formatierung von Typen und Custom Date and Time Format Strings.For more information about valid formatting values, see Formatting Types and Custom Date and Time Format Strings.

Sie können auch Ihren eigenen Satz von erstellen DataGridColumnStyle -Objekte und fügen sie der GridColumnStylesCollection.You can also create your own set of DataGridColumnStyle objects and add them to the GridColumnStylesCollection. Wenn Sie dies tun, müssen Sie festlegen der MappingName für jedes Spaltenformat, die ColumnName von eine DataColumn um die Anzeige der Spalten mit den tatsächlichen Daten zu synchronisieren.When you do so, you must set the MappingName of each column style to the ColumnName of a DataColumn to synchronize the display of columns with the actual data.

Achtung

Erstellen Sie immer DataGridColumnStyle -Objekte und fügen sie der GridColumnStylesCollection vor dem Hinzufügen von DataGridTableStyle Objekte die GridTableStylesCollection.Always create DataGridColumnStyle objects and add them to the GridColumnStylesCollection before adding DataGridTableStyle objects to the GridTableStylesCollection. Wenn Sie eine leere hinzufügen DataGridTableStyle mit einer gültigen MappingName Wert in der Auflistung DataGridColumnStyle Objekte automatisch für Sie generiert werden.When you add an empty DataGridTableStyle with a valid MappingName value to the collection, DataGridColumnStyle objects are automatically generated for you. Daher eine Ausnahme wird ausgelöst, wenn Sie versuchen, das Hinzufügen neuer DataGridColumnStyle Objekte mit doppelten MappingName -Werte in der GridColumnStylesCollection.Consequently, an exception will be thrown if you try to add new DataGridColumnStyle objects with duplicate MappingName values to the GridColumnStylesCollection.

Wenn eine abgeleitete Klasse instanziiert, indem eine System.Windows.Forms.DataGrid -Steuerelement die erstellte Klasse hängt von der DataType von der DataColumn zugeordnet der DataGridColumnStyle Objekt.When one of the derived classes is instantiated by a System.Windows.Forms.DataGrid control, the class created depends on the DataType of the DataColumn associated with the DataGridColumnStyle object. Z. B. eine DataColumn mit seiner DataType festgelegt System.Boolean zugeordnet wird eine DataGridBoolColumn.For example, a DataColumn with its DataType set to System.Boolean will be associated with a DataGridBoolColumn. Um zu bestimmen, den Typ any DataGridColumnStyle, verwenden Sie die GetType Methode.To determine the type of any DataGridColumnStyle, use the GetType method.

Um Ihre eigenen Spaltenklassen zu erstellen, können Sie von erben DataGridColumnStyle.To create your own column classes, you can inherit from DataGridColumnStyle. Empfiehlt es sich um spezielle Spalten, die Steuerelemente enthalten, zu erstellen, wie durch veranschaulicht dazu die DataGridTextBox Klasse, auf welchen Hosts die TextBox Steuerelement.You might want to do this in order to create special columns that host controls, as exemplified by the DataGridTextBox class, which hosts the TextBox control. Sie können z. B. Hosten einer Image steuern, um Bilder in Spalten anzuzeigen, oder Sie können Ihr eigenes Benutzersteuerelement zu Host erstellen, in der Spalte.For example, you can host an Image control to show pictures in columns, or you can create your own user control to host in the column.

Die Funktionalität der DataGridColumnStyle sollte nicht zu verwechseln mit der die DataColumn.The functionality of the DataGridColumnStyle shouldn't be confused with that of the DataColumn. Während der DataColumn enthält die Eigenschaften und Methoden zum Erstellen einer Datentabelle, die DataGridColumnStyle enthält die Eigenschaften und Methoden im Zusammenhang mit der die Darstellung einer einzelnen Spalte auf dem Bildschirm.Whereas the DataColumn contains the properties and methods appropriate to creating a data table's schema, the DataGridColumnStyle contains the properties and methods related to the appearance of an individual column on the screen.

Wenn eine Zeile enthält einen DBNull.Value, in der Spalte angezeigte Text kann festgelegt werden, mit der NullText Eigenschaft.If a row contains a DBNull.Value, the text displayed in the column can be set with the NullText property.

Die DataGridColumnStyle Klasse auch können Sie das Verhalten einer Spalte angeben, während die Daten geändert wird.The DataGridColumnStyle class also allows you to specify the behavior of a column while its data is being changed. Die BeginUpdate und EndUpdate Methoden das Zeichnen der Spalte zeitweilig anzuhalten, während die Spaltendaten großer Updates gestellt werden.The BeginUpdate and EndUpdate methods temporarily suspend the drawing of the column while large updates are being made to the column's data. Ohne diese Funktionalität wird jede Änderung in jeder Zelle des Rasters sofort gezeichnet. Dies ist möglicherweise für den Benutzer und Leistungsminderung ablenken.Without this functionality, every change in every cell of the grid would be immediately drawn; this could be distracting to the user and a performance liability.

Verschiedene Methoden ermöglichen die Überwachung der Spalte, während es vom Benutzer bearbeitet wird einschließlich der Edit und Commit Ereignisse.Several methods allow monitoring of the column as it is edited by the user, including the Edit and Commit events.

Die meisten Eigenschaften und Methoden der Klasse werden zur Steuerung der Darstellung einer Spalte angepasst.Most of the properties and methods of the class are tailored to controlling a column's appearance. Aber einige, z. B. die GetColumnValueAtRow und SetColumnValueAtRow ermöglichen es Ihnen, untersuchen und ändern Sie den Wert in eine angegebene Zelle.But a few, such as the GetColumnValueAtRow and SetColumnValueAtRow allow you to examine and change the value in a specified cell.

Hinweise für Vererber

Beim Erben von DataGridColumnStyle, müssen Sie die folgenden Member überschreiben: Abort(Int32), Commit(CurrencyManager, Int32), Edit(CurrencyManager, Int32, Rectangle, Boolean), und Paint(Graphics, Rectangle, CurrencyManager, Int32) (zweimal).When you inherit from DataGridColumnStyle, you must override the following members: Abort(Int32), Commit(CurrencyManager, Int32), Edit(CurrencyManager, Int32, Rectangle, Boolean), and Paint(Graphics, Rectangle, CurrencyManager, Int32) (twice).

Konstruktoren

DataGridColumnStyle() DataGridColumnStyle() DataGridColumnStyle() DataGridColumnStyle()

Initialisiert in einer abgeleiteten Klasse eine neue Instanz der DataGridColumnStyle-Klasse.In a derived class, initializes a new instance of the DataGridColumnStyle class.

DataGridColumnStyle(PropertyDescriptor) DataGridColumnStyle(PropertyDescriptor) DataGridColumnStyle(PropertyDescriptor) DataGridColumnStyle(PropertyDescriptor)

Initialisiert eine neue Instanz der DataGridColumnStyle-Klasse mit der angegebenen PropertyDescriptor.Initializes a new instance of the DataGridColumnStyle class with the specified PropertyDescriptor.

Eigenschaften

Alignment Alignment Alignment Alignment

Ruft die Textausrichtung in einer Spalte ab oder legt diese fest.Gets or sets the alignment of text in a column.

CanRaiseEvents CanRaiseEvents CanRaiseEvents CanRaiseEvents

Ruft einen Wert ab, der angibt, ob die Komponente ein Ereignis auslösen kann.Gets a value indicating whether the component can raise an event.

(Inherited from Component)
Container Container Container Container

Ruft den IContainer ab, der die Component enthält.Gets the IContainer that contains the Component.

(Inherited from Component)
DataGridTableStyle DataGridTableStyle DataGridTableStyle DataGridTableStyle

Ruft das DataGridTableStyle für die Spalte ab.Gets the DataGridTableStyle for the column.

DesignMode DesignMode DesignMode DesignMode

Ruft einen Wert ab, der angibt, ob sich Component gegenwärtig im Entwurfsmodus befindet.Gets a value that indicates whether the Component is currently in design mode.

(Inherited from Component)
Events Events Events Events

Ruft die Liste der Ereignishandler ab, die dieser Component angefügt sind.Gets the list of event handlers that are attached to this Component.

(Inherited from Component)
FontHeight FontHeight FontHeight FontHeight

Ruft die Höhe der in der Spalte verwendeten Schriftart ab.Gets the height of the column's font.

HeaderAccessibleObject HeaderAccessibleObject HeaderAccessibleObject HeaderAccessibleObject

Ruft das AccessibleObject für die Spalte ab.Gets the AccessibleObject for the column.

HeaderText HeaderText HeaderText HeaderText

Ruft den Text des Spaltenkopfs ab oder legt diesen fest.Gets or sets the text of the column header.

MappingName MappingName MappingName MappingName

Ruft den Namen des Datenmembers fest, dem das Spaltenformat zugeordnet werden soll, oder legt diesen fest.Gets or sets the name of the data member to map the column style to.

NullText NullText NullText NullText

Ruft den Text ab, der angezeigt wird, wenn die Spalte null enthält, oder legt diesen fest.Gets or sets the text that is displayed when the column contains null.

PropertyDescriptor PropertyDescriptor PropertyDescriptor PropertyDescriptor

Ruft den PropertyDescriptor ab, der die Attribute der Daten ermittelt, die vom DataGridColumnStyle angezeigt werden, oder legt diesen fest.Gets or sets the PropertyDescriptor that determines the attributes of data displayed by the DataGridColumnStyle.

ReadOnly ReadOnly ReadOnly ReadOnly

Ruft einen Wert ab, der angibt, ob die Daten in der Spalte bearbeitet werden können, oder legt diesen fest.Gets or sets a value indicating whether the data in the column can be edited.

Site Site Site Site

Ruft den ISite von Component ab oder legt ihn fest.Gets or sets the ISite of the Component.

(Inherited from Component)
Width Width Width Width

Ruft die Breite der Spalte ab oder legt diese fest.Gets or sets the width of the column.

Methoden

Abort(Int32) Abort(Int32) Abort(Int32) Abort(Int32)

Initiiert beim Überschreiben in einer abgeleiteten Klasse eine Anforderung zum Unterbrechen einer Bearbeitungsprozedur.When overridden in a derived class, initiates a request to interrupt an edit procedure.

BeginUpdate() BeginUpdate() BeginUpdate() BeginUpdate()

Unterbricht das Zeichnen der Spalte, bis die EndUpdate()-Methode aufgerufen wird.Suspends the painting of the column until the EndUpdate() method is called.

CheckValidDataSource(CurrencyManager) CheckValidDataSource(CurrencyManager) CheckValidDataSource(CurrencyManager) CheckValidDataSource(CurrencyManager)

Löst eine Ausnahme aus, wenn für das DataGrid keine gültige Datenquelle vorhanden ist oder diese Spalte keiner gültigen Eigenschaft in der Datenquelle zugeordnet ist.Throws an exception if the DataGrid does not have a valid data source, or if this column is not mapped to a valid property in the data source.

ColumnStartedEditing(Control) ColumnStartedEditing(Control) ColumnStartedEditing(Control) ColumnStartedEditing(Control)

Benachrichtigt DataGrid darüber, dass der Benutzer mit dem Bearbeiten der Spalte begonnen hat.Informs the DataGrid that the user has begun editing the column.

Commit(CurrencyManager, Int32) Commit(CurrencyManager, Int32) Commit(CurrencyManager, Int32) Commit(CurrencyManager, Int32)

Initiiert beim Überschreiben in einer abgeleiteten Klasse eine Anforderung zum Abschließen einer Bearbeitungsprozedur.When overridden in a derived class, initiates a request to complete an editing procedure.

ConcedeFocus() ConcedeFocus() ConcedeFocus() ConcedeFocus()

Teilt einer Spalte mit, dass sie den Fokus an das Steuerelement abgeben muss, das sie hostet.Notifies a column that it must relinquish the focus to the control it is hosting.

CreateHeaderAccessibleObject() CreateHeaderAccessibleObject() CreateHeaderAccessibleObject() CreateHeaderAccessibleObject()

Ruft das AccessibleObject für die Spalte ab.Gets the AccessibleObject for the column.

CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type)

Erstellt ein Objekt mit allen relevanten Informationen, die zum Generieren eines Proxys für die Kommunikation mit einem Remoteobjekt erforderlich sind.Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
Dispose() Dispose() Dispose() Dispose()

Gibt alle vom Component verwendeten Ressourcen frei.Releases all resources used by the Component.

(Inherited from Component)
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

Gibt die von Component verwendeten nicht verwalteten Ressourcen und optional die verwalteten Ressourcen frei.Releases the unmanaged resources used by the Component and optionally releases the managed resources.

(Inherited from Component)
Edit(CurrencyManager, Int32, Rectangle, Boolean) Edit(CurrencyManager, Int32, Rectangle, Boolean) Edit(CurrencyManager, Int32, Rectangle, Boolean) Edit(CurrencyManager, Int32, Rectangle, Boolean)

Bereitet eine Zelle für die Bearbeitung vor.Prepares a cell for editing.

Edit(CurrencyManager, Int32, Rectangle, Boolean, String) Edit(CurrencyManager, Int32, Rectangle, Boolean, String) Edit(CurrencyManager, Int32, Rectangle, Boolean, String) Edit(CurrencyManager, Int32, Rectangle, Boolean, String)

Bereitet die Zelle unter Verwendung des angegebenen CurrencyManager, der Zeilennummer und der Rectangle-Parameter für die Bearbeitung vor.Prepares the cell for editing using the specified CurrencyManager, row number, and Rectangle parameters.

Edit(CurrencyManager, Int32, Rectangle, Boolean, String, Boolean) Edit(CurrencyManager, Int32, Rectangle, Boolean, String, Boolean) Edit(CurrencyManager, Int32, Rectangle, Boolean, String, Boolean) Edit(CurrencyManager, Int32, Rectangle, Boolean, String, Boolean)

Bereitet beim Überschreiben in einer abgeleiteten Klasse eine Zelle für die Bearbeitung vor.When overridden in a deriving class, prepares a cell for editing.

EndUpdate() EndUpdate() EndUpdate() EndUpdate()

Setzt das Zeichnen von Spalten fort, das durch den Aufruf der BeginUpdate()-Methode unterbrochen wurde.Resumes the painting of columns suspended by calling the BeginUpdate() method.

EnterNullValue() EnterNullValue() EnterNullValue() EnterNullValue()

Gibt einen Value in die Spalte ein.Enters a Value into the column.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Bestimmt, ob das angegebene Objekt mit dem aktuellen Objekt identisch ist.Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetColumnValueAtRow(CurrencyManager, Int32) GetColumnValueAtRow(CurrencyManager, Int32) GetColumnValueAtRow(CurrencyManager, Int32) GetColumnValueAtRow(CurrencyManager, Int32)

Ruft den Wert in der angegebenen Zeile aus dem angegebenen CurrencyManager ab.Gets the value in the specified row from the specified CurrencyManager.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Fungiert als Standardhashfunktion.Serves as the default hash function.

(Inherited from Object)
GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()

Ruft das aktuelle Lebensdauerdienstobjekt ab, das die Lebensdauerrichtlinien für diese Instanz steuert.Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetMinimumHeight() GetMinimumHeight() GetMinimumHeight() GetMinimumHeight()

Ruft beim Überschreiben in einer abgeleiteten Klasse die Mindesthöhe einer Zeile ab.When overridden in a derived class, gets the minimum height of a row.

GetPreferredHeight(Graphics, Object) GetPreferredHeight(Graphics, Object) GetPreferredHeight(Graphics, Object) GetPreferredHeight(Graphics, Object)

Ruft beim Überschreiben in einer abgeleiteten Klasse die für die automatische Größenänderung von Spalten verwendete Höhe ab.When overridden in a derived class, gets the height used for automatically resizing columns.

GetPreferredSize(Graphics, Object) GetPreferredSize(Graphics, Object) GetPreferredSize(Graphics, Object) GetPreferredSize(Graphics, Object)

Ruft beim Überschreiben in einer abgeleiteten Klasse die Breite und Höhe des angegebenen Werts ab.When overridden in a derived class, gets the width and height of the specified value. Die Breite und Höhe werden verwendet, wenn der Benutzer mithilfe des DataGridTableStyle zum DataGridColumnStyle navigiert.The width and height are used when the user navigates to DataGridTableStyle using the DataGridColumnStyle.

GetService(Type) GetService(Type) GetService(Type) GetService(Type)

Gibt ein Objekt zurück, das einen von der Component oder von deren Container bereitgestellten Dienst darstellt.Returns an object that represents a service provided by the Component or by its Container.

(Inherited from Component)
GetType() GetType() GetType() GetType()

Ruft den Type der aktuellen Instanz ab.Gets the Type of the current instance.

(Inherited from Object)
InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

Ruft ein Lebensdauerdienstobjekt zur Steuerung der Lebensdauerrichtlinie für diese Instanz ab.Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
Invalidate() Invalidate() Invalidate() Invalidate()

Zeichnet die Spalte neu und bewirkt, dass eine Zeichenmeldung an das Steuerelement gesendet wird.Redraws the column and causes a paint message to be sent to the control.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Erstellt eine flache Kopie des aktuellen Object.Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean)

Erstellt eine flache Kopie des aktuellen MarshalByRefObject-Objekts.Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
Paint(Graphics, Rectangle, CurrencyManager, Int32) Paint(Graphics, Rectangle, CurrencyManager, Int32) Paint(Graphics, Rectangle, CurrencyManager, Int32) Paint(Graphics, Rectangle, CurrencyManager, Int32)

Zeichnet den DataGridColumnStyle mit dem angegebenen Graphics, dem angegebenen Rectangle, dem angegebenen CurrencyManager und der angegebenen Zeilennummer.Paints the DataGridColumnStyle with the specified Graphics, Rectangle, CurrencyManager, and row number.

Paint(Graphics, Rectangle, CurrencyManager, Int32, Boolean) Paint(Graphics, Rectangle, CurrencyManager, Int32, Boolean) Paint(Graphics, Rectangle, CurrencyManager, Int32, Boolean) Paint(Graphics, Rectangle, CurrencyManager, Int32, Boolean)

Zeichnet beim Überschreiben in einer abgeleiteten Klasse einen DataGridColumnStyle mit der angegebenen Graphics, dem angegebenen Rectangle, dem angegebenen CurrencyManager sowie der Zeilennummer und Ausrichtung.When overridden in a derived class, paints a DataGridColumnStyle with the specified Graphics, Rectangle, CurrencyManager, row number, and alignment.

Paint(Graphics, Rectangle, CurrencyManager, Int32, Brush, Brush, Boolean) Paint(Graphics, Rectangle, CurrencyManager, Int32, Brush, Brush, Boolean) Paint(Graphics, Rectangle, CurrencyManager, Int32, Brush, Brush, Boolean) Paint(Graphics, Rectangle, CurrencyManager, Int32, Brush, Brush, Boolean)

Zeichnet einen DataGridColumnStyle mit der angegebenen Graphics, dem angegebenen Rectangle, dem angegebenen CurrencyManager, der Zeilennummer, Hintergrundfarbe, Vordergrundfarbe und Ausrichtung.Paints a DataGridColumnStyle with the specified Graphics, Rectangle, CurrencyManager, row number, background color, foreground color, and alignment.

ReleaseHostedControl() ReleaseHostedControl() ReleaseHostedControl() ReleaseHostedControl()

Ermöglicht es, dass die Spalte Ressourcen freigibt, wenn das in der Spalte gehostete Steuerelement nicht benötigt wird.Allows the column to free resources when the control it hosts is not needed.

ResetHeaderText() ResetHeaderText() ResetHeaderText() ResetHeaderText()

Setzt den HeaderText auf den Standardwert null zurück.Resets the HeaderText to its default value, null.

SetColumnValueAtRow(CurrencyManager, Int32, Object) SetColumnValueAtRow(CurrencyManager, Int32, Object) SetColumnValueAtRow(CurrencyManager, Int32, Object) SetColumnValueAtRow(CurrencyManager, Int32, Object)

Legt für den Wert in einer angegebenen Zeile den Wert aus einem angegebenen CurrencyManager fest.Sets the value in a specified row with the value from a specified CurrencyManager.

SetDataGrid(DataGrid) SetDataGrid(DataGrid) SetDataGrid(DataGrid) SetDataGrid(DataGrid)

Legt das DataGrid-Steuerelement fest, zu dem diese Spalte gehört.Sets the DataGrid control that this column belongs to.

SetDataGridInColumn(DataGrid) SetDataGridInColumn(DataGrid) SetDataGridInColumn(DataGrid) SetDataGridInColumn(DataGrid)

Legt das DataGrid für die Spalte fest.Sets the DataGrid for the column.

ToString() ToString() ToString() ToString()

Gibt einen String zurück, der den Namen der Component enthält (sofern vorhanden).Returns a String containing the name of the Component, if any. Diese Methode darf nicht überschrieben werden.This method should not be overridden.

(Inherited from Component)
UpdateUI(CurrencyManager, Int32, String) UpdateUI(CurrencyManager, Int32, String) UpdateUI(CurrencyManager, Int32, String) UpdateUI(CurrencyManager, Int32, String)

Aktualisiert den Wert einer angegebenen Zeile mit dem angegebenen Text.Updates the value of a specified row with the given text.

Ereignisse

AlignmentChanged AlignmentChanged AlignmentChanged AlignmentChanged

Tritt ein, wenn der Alignment-Eigenschaftswert geändert wird.Occurs when the Alignment property value changes.

Disposed Disposed Disposed Disposed

Tritt ein, wenn die Komponente durch einen Aufruf der Dispose()-Methode freigegeben wird.Occurs when the component is disposed by a call to the Dispose() method.

(Inherited from Component)
FontChanged FontChanged FontChanged FontChanged

Tritt ein, wenn die Schriftart der Spalte geändert wird.Occurs when the column's font changes.

HeaderTextChanged HeaderTextChanged HeaderTextChanged HeaderTextChanged

Tritt ein, wenn der HeaderText-Eigenschaftswert geändert wird.Occurs when the HeaderText property value changes.

MappingNameChanged MappingNameChanged MappingNameChanged MappingNameChanged

Tritt ein, wenn sich der MappingName-Wert ändert.Occurs when the MappingName value changes.

NullTextChanged NullTextChanged NullTextChanged NullTextChanged

Tritt ein, wenn sich der NullText-Wert ändert.Occurs when the NullText value changes.

PropertyDescriptorChanged PropertyDescriptorChanged PropertyDescriptorChanged PropertyDescriptorChanged

Tritt ein, wenn der PropertyDescriptor-Eigenschaftswert geändert wird.Occurs when the PropertyDescriptor property value changes.

ReadOnlyChanged ReadOnlyChanged ReadOnlyChanged ReadOnlyChanged

Tritt ein, wenn der ReadOnly-Eigenschaftswert geändert wird.Occurs when the ReadOnly property value changes.

WidthChanged WidthChanged WidthChanged WidthChanged

Tritt ein, wenn der Width-Eigenschaftswert geändert wird.Occurs when the Width property value changes.

Explizite Schnittstellenimplementierungen

IDataGridColumnStyleEditingNotificationService.ColumnStartedEditing(Control) IDataGridColumnStyleEditingNotificationService.ColumnStartedEditing(Control) IDataGridColumnStyleEditingNotificationService.ColumnStartedEditing(Control) IDataGridColumnStyleEditingNotificationService.ColumnStartedEditing(Control)

Benachrichtigt das DataGrid-Steuerelement darüber, dass der Benutzer mit dem Bearbeiten der Spalte begonnen hat.Informs the DataGrid control that the user has begun editing the column.

Gilt für:

Siehe auch