DataGridColumnStyleとは? わかりやすく解説

DataGridColumnStyle イベント


パブリック イベントパブリック イベント

  名前 説明
パブリック イベント Disposed  コンポーネントDisposed イベント待機するイベント ハンドラ追加します。 ( Component から継承されます。)
パブリック イベント FontChanged 列のフォント変更されたときに発生します
パブリック イベント HeaderTextChanged HeaderText プロパティの値が変更され場合発生します
パブリック イベント MappingNameChanged MappingName の値が変更され場合発生します
パブリック イベント NullTextChanged NullText の値が変更され場合発生します
パブリック イベント PropertyDescriptorChanged PropertyDescriptor プロパティの値が変更され場合発生します
パブリック イベント ReadOnlyChanged ReadOnly プロパティの値が変更され場合発生します
パブリック イベント WidthChanged Width プロパティの値が変更され場合発生します
参照参照

関連項目

DataGridColumnStyle クラス
System.Windows.Forms 名前空間
DataColumn
DataGrid クラス
DataGridBoolColumn クラス
DataGridTextBox
DataGridColumnStyle.DataGridTableStyle プロパティ
DataView
GridColumnStylesCollection

DataGridColumnStyle クラス

System.Windows.Forms.DataGrid コントロールの列に関する外観テキスト書式、および動作指定します。このクラス抽象クラスです。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public MustInherit Class
 DataGridColumnStyle
    Inherits Component
    Implements IDataGridColumnStyleEditingNotificationService
Dim instance As DataGridColumnStyle
public abstract class DataGridColumnStyle :
 Component, IDataGridColumnStyleEditingNotificationService
public ref class DataGridColumnStyle abstract
 : public Component, IDataGridColumnStyleEditingNotificationService
public abstract class DataGridColumnStyle extends
 Component implements IDataGridColumnStyleEditingNotificationService
public abstract class DataGridColumnStyle extends
 Component implements IDataGridColumnStyleEditingNotificationService
解説解説

DataGridColumnStyle オブジェクトコレクション (GridColumnStylesCollection) は、System.Windows.Forms.DataGrid コントロールの TableStyles プロパティ通じてアクセスます。

System.Windows.Forms.DataGrid コントロールでは、DataSource プロパティ適切なデータ ソース設定すると、DataGridColumnStyle オブジェクトコレクション自動的に作成されます。作成されオブジェクトは、実際にDataGridColumnStyle クラスから継承された、DataGridBoolColumn または DataGridTextBoxColumn のいずれかクラスインスタンスです。

データ表示書式指定するには、DataGridTextBoxColumn クラスFormat プロパティ書式指定値のいずれかに設定します有効な書式指定値の詳細については、「日付と時刻書式指定文字列」と「標準数値書式指定文字列」を参照してください

独自の DataGridColumnStyle オブジェクト セット作成し、それらのオブジェクトGridColumnStylesCollection追加することもできます。この操作を行うときは、各列スタイルの MappingName を DataColumn の ColumnName に設定して実際のデータと列表示同期させます

注意に関するメモ注意

必ず DataGridColumnStyle オブジェクト作成して GridColumnStylesCollection追加してから、DataGridTableStyle オブジェクトを GridTableStylesCollection に追加します有効な MappingName 値を持つ空の DataGridTableStyleコレクション追加すると、自動的に DataGridColumnStyle オブジェクト生成されます。そのため、MappingName 値が重複する新しDataGridColumnStyle オブジェクトGridColumnStylesCollection追加しようとすると、例外スローさます。

System.Windows.Forms.DataGrid コントロールによって派生クラスいずれかインスタンス化される場合作成されるクラスは、DataGridColumnStyle オブジェクト関連付けられた DataColumnDataType によって異なります。たとえば、DataTypeSystem.Boolean設定されDataColumn は、DataGridBoolColumn関連付けられます。DataGridColumnStyle の型を確認するには、GetType メソッド使用します

独自の列クラス作成するには、DataGridColumnStyle から継承できますTextBox コントロールホストする DataGridTextBox クラス場合のように、コントロールホストする特別な列を作成するために独自の列クラス作成できます。たとえば、Image コントロールホストして列にイメージ表示したり、独自のユーザー コントロール作成して列でホストしたりできます

DataGridColumnStyle機能は、DataColumn機能とは異なりますDataColumnデータ テーブルスキーマ作成使用するプロパティおよびメソッド格納しているのに対しDataGridColumnStyle画面上の各列の外観関連するプロパティおよびメソッド格納してます。

行が DBNull.Value を格納している場合、列に表示されるテキストは NullText プロパティ使用して設定できます

DataGridColumnStyle クラス使用すると、データ変更中に列の動作指定することもできます。BeginUpdate メソッドと EndUpdate メソッドは、列のデータに対して大規模な更新が行われている間、一時的に列の描画中断します。この機能使用しない場合グリッドの各セル変更されるたびに描画されるため、ユーザーストレス感じたり、パフォーマンス低下したりします

Edit イベントCommit イベントなどメソッド使用すると、ユーザー編集する列を監視できます

このクラスプロパティおよびメソッド多くは、列の外観制御するために使用されます。ただし、GetColumnValueAtRow や SetColumnValueAtRow などのメソッドは、指定したセルの値を調べたり変更したできます

実装時の注意 DataGridColumnStyle から継承する場合は、AbortCommitEditPaint (2 回) の各メンバオーバーライドする必要があります

使用例使用例

DateTimePicker コントロールホストする DataGridColumnStyle作成するコード例次に示します

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 Not (customDateTimePicker1.Parent
 Is Nothing) Then
            customDateTimePicker1.Parent.Controls.Remove(customDateTimePicker1)
        End If
        If Not (value Is
 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
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()
    {
        MyForm myForm1 = new MyForm();
        myForm1.ShowDialog();
    }
}
#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()
{
   MyForm^ myForm1 = gcnew MyForm;
   myForm1->ShowDialog();
}
継承階層継承階層
System.Object
   System.MarshalByRefObject
     System.ComponentModel.Component
      System.Windows.Forms.DataGridColumnStyle
         Microsoft.CLRAdmin.DataGridComboBoxColumnStyle
         System.Windows.Forms.DataGridBoolColumn
         System.Windows.Forms.DataGridTextBoxColumn
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridColumnStyle メンバ
System.Windows.Forms 名前空間
DataColumn
DataGrid クラス
DataGridBoolColumn クラス
DataGridTextBox
DataGridTableStyle
DataView
GridColumnStylesCollection

DataGridColumnStyle コンストラクタ ()

派生クラスで、DataGridColumnStyle クラス新しインスタンス初期化します。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Dim instance As New DataGridColumnStyle
public DataGridColumnStyle ()
public:
DataGridColumnStyle ()
public DataGridColumnStyle ()
public function DataGridColumnStyle ()
解説解説

DataGridColumnStyleインスタンス作成すると、次のプロパティ初期化されます

プロパティ

既定値

Alignment

HorizontalAlignment.Left

DataGridTableStyle

null 参照 (Visual Basic では Nothing)

FontHeight

-1

Invalidate

false

NullText

"(null)" 文字列

ReadOnly

false

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridColumnStyle クラス
DataGridColumnStyle メンバ
System.Windows.Forms 名前空間
DataColumn
DataGrid クラス

DataGridColumnStyle コンストラクタ (PropertyDescriptor)

PropertyDescriptor指定して、DataGridColumnStyle クラス新しインスタンス初期化します。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Sub New ( _
    prop As PropertyDescriptor _
)
Dim prop As PropertyDescriptor

Dim instance As New DataGridColumnStyle(prop)
public DataGridColumnStyle (
    PropertyDescriptor prop
)
public:
DataGridColumnStyle (
    PropertyDescriptor^ prop
)
public DataGridColumnStyle (
    PropertyDescriptor prop
)
public function DataGridColumnStyle (
    prop : PropertyDescriptor
)

パラメータ

prop

列の属性提供する PropertyDescriptor。

解説解説

新しDataGridColumnStyle作成するには、最初に列を追加するテーブルデータ ソースの CurrencyManager を取得する必要がありますフォーム特定の CurrencyManager オブジェクト取得する方法については、CurrencyManager および BindingManagerトピック参照してください

CurrencyManager から、列のデータ提供する DataColumn の PropertyDescriptor取得できます

DataGridColumnStyleインスタンス作成すると、次の読み書き可能プロパティ初期化されます

プロパティ

初期値

Alignment

HorizontalAlignment.Left

DataGridTableStyle

null 参照 (Visual Basic では Nothing)

FontHeight

-1

Invalidate

false

NullText

"(null)"

ReadOnly

false

使用例使用例

新しい DataGridTextBoxColumn (DataGridColumnStyle から派生) を作成し、DataGridTableStyle の GridColumnStylesCollection に追加するコード例次に示します

Private Sub CreateNewDataGridColumnStyle()
   Dim myDataSet As New
 DataSet("myDataSet")
   ' Insert code to populate the DataSet.

   ' Get the CurrencyManager for the table you want to add a column
 to.
   Dim myCurrencyManager As CurrencyManager
 = CType _
   (Me.BindingContext(myDataSet.Tables("Suppliers")),
 CurrencyManager)

   ' Get the PropertyDescriptor for the DataColumn.
   Dim pd As PropertyDescriptor = _
   myCurrencyManager.GetItemProperties()("City")

   ' Construct the DataGridColumnStyle with the PropertyDescriptor.
   Dim myColumn As New DataGridTextBoxColumn(pd)
   myColumn.MappingName = "City"
   dataGrid1.TableStyles(0).GridColumnStyles.Add(myColumn)

End Sub 
private void CreateNewDataGridColumnStyle(){
  DataSet myDataSet = new DataSet("myDataSet");
   // Insert code to populate the DataSet.
    
   // Get the CurrencyManager for the table you want to add a column
 to.
  CurrencyManager myCurrencyManager = 
  (CurrencyManager)this.BindingContext[myDataSet, "Suppliers"];

  // Get the PropertyDescriptor for the DataColumn.
  PropertyDescriptor pd = myCurrencyManager.GetItemProperties()["City"];

   // Construct the DataGridColumnStyle with the PropertyDescriptor.
  DataGridColumnStyle myColumn = new DataGridTextBoxColumn(pd);
  myColumn.MappingName = "City";
  dataGrid1.TableStyles[0].GridColumnStyles.Add(myColumn);
}
void CreateNewDataGridColumnStyle()
{
   DataSet^ myDataSet = gcnew DataSet( "myDataSet" );
   
   // Insert code to populate the DataSet.
   // Get the CurrencyManager for the table you want to add a column
 to.
   CurrencyManager^ myCurrencyManager = dynamic_cast<CurrencyManager^>(this->BindingContext[myDataSet,
 "Suppliers"]);
   
   // Get the PropertyDescriptor for the DataColumn.
   PropertyDescriptor^ pd = myCurrencyManager->GetItemProperties()[ "City"
 ];
   
   // Construct the DataGridColumnStyle with the PropertyDescriptor.
   DataGridColumnStyle^ myColumn = gcnew DataGridTextBoxColumn( pd );
   myColumn->MappingName = "City";
   dataGrid1->TableStyles[ 0 ]->GridColumnStyles->Add( myColumn );
}

private void CreateNewDataGridColumnStyle()
{
    DataSet myDataSet = new DataSet("myDataSet");
    // Insert code to populate the DataSet.
    // Get the CurrencyManager for the table you want to add a column
 to.
    CurrencyManager myCurrencyManager = 
        (CurrencyManager)(this.get_BindingContext().
        get_Item(myDataSet, "Suppliers"));
    // Get the PropertyDescriptor for the DataColumn.
    PropertyDescriptor pd = myCurrencyManager.GetItemProperties().
        get_Item("City");
    // Construct the DataGridColumnStyle with the PropertyDescriptor.
    DataGridColumnStyle myColumn = new DataGridTextBoxColumn(pd);
    myColumn.set_MappingName("City");
    dataGrid1.get_TableStyles().get_Item(0).
        get_GridColumnStyles().Add(myColumn);
} //CreateNewDataGridColumnStyle
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridColumnStyle クラス
DataGridColumnStyle メンバ
System.Windows.Forms 名前空間
DataColumn

DataGridColumnStyle コンストラクタ

DataGridColumnStyle クラス新しインスタンス初期化します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
DataGridColumnStyle () 派生クラスで、DataGridColumnStyle クラス新しインスタンス初期化します。

.NET Compact Framework によってサポートされています。

DataGridColumnStyle (PropertyDescriptor) PropertyDescriptor を指定してDataGridColumnStyle クラス新しインスタンス初期化します。
参照参照

関連項目

DataGridColumnStyle クラス
DataGridColumnStyle メンバ
System.Windows.Forms 名前空間
DataColumn
DataGrid クラス

DataGridColumnStyle プロパティ


パブリック プロパティパブリック プロパティ

プロテクト プロパティプロテクト プロパティ
参照参照

関連項目

DataGridColumnStyle クラス
System.Windows.Forms 名前空間
DataColumn
DataGrid クラス
DataGridBoolColumn クラス
DataGridTextBox
DataGridTableStyle
DataView
GridColumnStylesCollection

DataGridColumnStyle メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド参照)
  名前 説明
パブリック メソッド CreateObjRef  リモート オブジェクトとの通信使用するプロキシ生成必要な情報をすべて格納しているオブジェクト作成します。 ( MarshalByRefObject から継承されます。)
パブリック メソッド Dispose  オーバーロードされますComponent によって使用されているリソース解放します。 ( Component から継承されます。)
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 ( Object から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用適してます。 ( Object から継承されます。)
パブリック メソッド GetLifetimeService  対象インスタンス有効期間ポリシー制御する現在の有効期間サービス オブジェクト取得します。 ( MarshalByRefObject から継承されます。)
パブリック メソッド GetType  現在のインスタンスType取得します。 ( Object から継承されます。)
パブリック メソッド InitializeLifetimeService  対象インスタンス有効期間ポリシー制御する有効期間サービス オブジェクト取得します。 ( MarshalByRefObject から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 ( Object から継承されます。)
パブリック メソッド ResetHeaderText HeaderText を既定値 null 参照 (Visual Basic では Nothing) にリセットします。
パブリック メソッド ToString  Component の名前を格納している String返します (存在する場合)。このメソッドオーバーライドできません。 ( Component から継承されます。)
プロテクト メソッドプロテクト メソッド
  名前 説明
プロテクト メソッド Abort 派生クラスオーバーライドされると、編集プロシージャ中断する要求実行します
プロテクト メソッド BeginUpdate EndUpdate メソッド呼び出されるまで、列の描画中断します
プロテクト メソッド CheckValidDataSource System.Windows.Forms.DataGrid が有効なデータ ソース保持してない場合、またはこの列がデータ ソース有効なプロパティ割り当てられていない場合は、例外スローさます。
プロテクト メソッド ColumnStartedEditing ユーザーが列の編集開始したことを System.Windows.Forms.DataGrid通知します
プロテクト メソッド Commit 派生クラスオーバーライドされると、編集プロシージャ完了する要求実行します
プロテクト メソッド ConcedeFocus 列がホストしているコントロールへのフォーカス放棄する必要があることを列に通知します
プロテクト メソッド CreateHeaderAccessibleObject 列の AccessibleObject を取得します
プロテクト メソッド Dispose  オーバーロードされますComponent によって使用されているリソース解放します。 ( Component から継承されます。)
プロテクト メソッド Edit オーバーロードされます。 値を編集するためにセル準備します
プロテクト メソッド EndUpdate BeginUpdate メソッド呼び出して中断されていた列の描画再開します
プロテクト メソッド EnterNullValue DBNull.Value を列に入力します
プロテクト メソッド Finalize  Componentガベージ コレクションによってクリアされる前に、アンマネージ リソース解放しその他のクリーンアップ操作実行します。 ( Component から継承されます。)
プロテクト メソッド GetColumnValueAtRow 指定した CurrencyManager から、指定した行の値を取得します
プロテクト メソッド GetMinimumHeight 派生クラスオーバーライドされると、行の最小の高さを取得します
プロテクト メソッド GetPreferredHeight 派生クラスオーバーライドされると、列のサイズ自動的に変更するために使用する高さを取得します
プロテクト メソッド GetPreferredSize 派生クラスオーバーライドされると、指定した値の幅および高さを取得します。この幅と高さは、ユーザーが DataGridColumnStyle を使用して DataGridTableStyle に移動するときに使用されます。
プロテクト メソッド GetService  Component またはその Container提供されるサービスを表すオブジェクト返します。 ( Component から継承されます。)
プロテクト メソッド Invalidate 列を再描画し、描画メッセージコントロール送信されます。
プロテクト メソッド MemberwiseClone  オーバーロードされます。 ( MarshalByRefObject から継承されます。)
プロテクト メソッド Paint オーバーロードされます派生クラスオーバーライドされると、System.Windows.Forms.DataGrid コントロールの列を描画ます。
プロテクト メソッド ReleaseHostedControl 列がホストするコントロール不要な場合に、その列がリソース解放できるようにします。
プロテクト メソッド SetColumnValueAtRow 指定した CurrencyManager からの値を使用して指定した行の値を設定します
プロテクト メソッド SetDataGrid この列が属すSystem.Windows.Forms.DataGrid コントロール設定します
プロテクト メソッド SetDataGridInColumn 列の System.Windows.Forms.DataGrid設定します
プロテクト メソッド UpdateUI 指定されテキスト使用して指定した行の値を更新します
明示的インターフェイスの実装明示的インターフェイス実装
  名前 説明
インターフェイスの明示的な実装 System.Windows.Forms.IDataGridColumnStyleEditingNotificationService.ColumnStartedEditing ユーザーが列の編集開始したことを DataGrid コントロール通知します
参照参照

関連項目

DataGridColumnStyle クラス
System.Windows.Forms 名前空間
DataColumn
DataGrid クラス
DataGridBoolColumn クラス
DataGridTextBox
DataGridTableStyle
DataView
GridColumnStylesCollection

DataGridColumnStyle メンバ

System.Windows.Forms.DataGrid コントロールの列に関する外観テキスト書式、および動作指定します。このクラス抽象クラスです。

DataGridColumnStyle データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド DataGridColumnStyle オーバーロードされます。 DataGridColumnStyle クラス新しインスタンス初期化します。
パブリック プロパティパブリック プロパティ
プロテクト プロパティプロテクト プロパティ
パブリック メソッドパブリック メソッド
( プロテクト メソッド参照)
  名前 説明
パブリック メソッド CreateObjRef  リモート オブジェクトとの通信使用するプロキシ生成必要な情報をすべて格納しているオブジェクト作成します。 (MarshalByRefObject から継承されます。)
パブリック メソッド Dispose  オーバーロードされますComponent によって使用されているリソース解放します。 (Component から継承されます。)
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 (Object から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用適してます。 (Object から継承されます。)
パブリック メソッド GetLifetimeService  対象インスタンス有効期間ポリシー制御する現在の有効期間サービス オブジェクト取得します。 (MarshalByRefObject から継承されます。)
パブリック メソッド GetType  現在のインスタンスType取得します。 (Object から継承されます。)
パブリック メソッド InitializeLifetimeService  対象インスタンス有効期間ポリシー制御する有効期間サービス オブジェクト取得します。 (MarshalByRefObject から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 (Object から継承されます。)
パブリック メソッド ResetHeaderText HeaderText既定値 null 参照 (Visual Basic では Nothing) にリセットします。
パブリック メソッド ToString  Component の名前を格納している String返します (存在する場合)。このメソッドオーバーライドできません。 (Component から継承されます。)
プロテクト メソッドプロテクト メソッド
  名前 説明
プロテクト メソッド Abort 派生クラスオーバーライドされると、編集プロシージャ中断する要求実行します
プロテクト メソッド BeginUpdate EndUpdate メソッド呼び出されるまで、列の描画中断します
プロテクト メソッド CheckValidDataSource System.Windows.Forms.DataGrid有効なデータ ソース保持してない場合、またはこの列がデータ ソース有効なプロパティ割り当てられていない場合は、例外スローさます。
プロテクト メソッド ColumnStartedEditing ユーザーが列の編集開始したことを System.Windows.Forms.DataGrid通知します
プロテクト メソッド Commit 派生クラスオーバーライドされると、編集プロシージャ完了する要求実行します
プロテクト メソッド ConcedeFocus 列がホストしているコントロールへのフォーカス放棄する必要があることを列に通知します
プロテクト メソッド CreateHeaderAccessibleObject 列の AccessibleObject取得します
プロテクト メソッド Dispose  オーバーロードされますComponent によって使用されているリソース解放します。 (Component から継承されます。)
プロテクト メソッド Edit オーバーロードされます。 値を編集するためにセル準備します
プロテクト メソッド EndUpdate BeginUpdate メソッド呼び出して中断されていた列の描画再開します
プロテクト メソッド EnterNullValue DBNull.Value を列に入力します
プロテクト メソッド Finalize  Componentガベージ コレクションによってクリアされる前に、アンマネージ リソース解放しその他のクリーンアップ操作実行します。 (Component から継承されます。)
プロテクト メソッド GetColumnValueAtRow 指定した CurrencyManager から、指定した行の値を取得します
プロテクト メソッド GetMinimumHeight 派生クラスオーバーライドされると、行の最小の高さを取得します
プロテクト メソッド GetPreferredHeight 派生クラスオーバーライドされると、列のサイズ自動的に変更するために使用する高さを取得します
プロテクト メソッド GetPreferredSize 派生クラスオーバーライドされると、指定した値の幅および高さを取得します。この幅と高さは、ユーザーDataGridColumnStyle使用して DataGridTableStyle移動するときに使用されます。
プロテクト メソッド GetService  Component またはその Container提供されるサービスを表すオブジェクト返します。 (Component から継承されます。)
プロテクト メソッド Invalidate 列を再描画し、描画メッセージコントロール送信されます。
プロテクト メソッド MemberwiseClone  オーバーロードされます。 ( MarshalByRefObject から継承されます。)
プロテクト メソッド Paint オーバーロードされます派生クラスオーバーライドされると、System.Windows.Forms.DataGrid コントロールの列を描画ます。
プロテクト メソッド ReleaseHostedControl 列がホストするコントロール不要な場合に、その列がリソース解放できるようにします。
プロテクト メソッド SetColumnValueAtRow 指定した CurrencyManager からの値を使用して指定した行の値を設定します
プロテクト メソッド SetDataGrid この列が属すSystem.Windows.Forms.DataGrid コントロール設定します
プロテクト メソッド SetDataGridInColumn 列の System.Windows.Forms.DataGrid設定します
プロテクト メソッド UpdateUI 指定されテキスト使用して指定した行の値を更新します
パブリック イベントパブリック イベント
  名前 説明
パブリック イベント Disposed  コンポーネントDisposed イベント待機するイベント ハンドラ追加します。(Component から継承されます。)
パブリック イベント FontChanged 列のフォント変更されたときに発生します
パブリック イベント HeaderTextChanged HeaderText プロパティの値が変更され場合発生します
パブリック イベント MappingNameChanged MappingName の値が変更され場合発生します
パブリック イベント NullTextChanged NullText の値が変更され場合発生します
パブリック イベント PropertyDescriptorChanged PropertyDescriptor プロパティの値が変更され場合発生します
パブリック イベント ReadOnlyChanged ReadOnly プロパティの値が変更され場合発生します
パブリック イベント WidthChanged Width プロパティの値が変更され場合発生します
明示的インターフェイスの実装明示的インターフェイス実装
  名前 説明
インターフェイスの明示的な実装 System.Windows.Forms.IDataGridColumnStyleEditingNotificationService.ColumnStartedEditing ユーザーが列の編集開始したことを DataGrid コントロール通知します
参照参照

関連項目

DataGridColumnStyle クラス
System.Windows.Forms 名前空間
DataColumn
DataGrid クラス
DataGridBoolColumn クラス
DataGridTextBox
DataGridTableStyle
DataView
GridColumnStylesCollection



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DataGridColumnStyle」の関連用語

DataGridColumnStyleのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DataGridColumnStyleのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS