次の方法で共有


DataGridBoolColumn クラス

定義

注意事項

DataGrid is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use DataGridView instead.

各セルにブール値を表すチェック ボックスが含まれている列を指定します。

public ref class DataGridBoolColumn : System::Windows::Forms::DataGridColumnStyle
public class DataGridBoolColumn : System.Windows.Forms.DataGridColumnStyle
[System.ComponentModel.Browsable(false)]
[System.Obsolete("`DataGrid` is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use `DataGridView` instead.", false, DiagnosticId="WFDEV006", UrlFormat="https://aka.ms/winforms-warnings/{0}")]
public class DataGridBoolColumn : System.Windows.Forms.DataGridColumnStyle
type DataGridBoolColumn = class
    inherit DataGridColumnStyle
[<System.ComponentModel.Browsable(false)>]
[<System.Obsolete("`DataGrid` is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use `DataGridView` instead.", false, DiagnosticId="WFDEV006", UrlFormat="https://aka.ms/winforms-warnings/{0}")>]
type DataGridBoolColumn = class
    inherit DataGridColumnStyle
Public Class DataGridBoolColumn
Inherits DataGridColumnStyle
継承
属性

次のコード例では、最初に新しいDataGridBoolColumnを作成し、DataGridTableStyleGridColumnStylesCollectionに追加します。

using namespace System;
using namespace System::Data;
using namespace System::Windows::Forms;
using namespace System::Drawing;
using namespace System::ComponentModel;

public ref class DataGridBoolColumnInherit: public DataGridBoolColumn
{
private:
   SolidBrush^ trueBrush;
   SolidBrush^ falseBrush;
   DataColumn^ expressionColumn;
   static int count = 0;

public:
   DataGridBoolColumnInherit()
      : DataGridBoolColumn()
   {
      trueBrush = dynamic_cast<SolidBrush^>(Brushes::Blue);
      falseBrush = dynamic_cast<SolidBrush^>(Brushes::Yellow);
      expressionColumn = nullptr;
      count++;
   }

   property Color FalseColor 
   {
      Color get()
      {
         return falseBrush->Color;
      }

      void set( Color value )
      {
         falseBrush = gcnew System::Drawing::SolidBrush( value );
         Invalidate();
      }
   }

   property Color TrueColor 
   {
      Color get()
      {
         return trueBrush->Color;
      }

      void set( Color value )
      {
         trueBrush = gcnew System::Drawing::SolidBrush( value );
         Invalidate();
      }
   }

   property String^ Expression 
   {
      // This will work only with a DataSet or DataTable.
      // The code is not compatible with IBindingList* implementations.
      String^ get()
      {
         return this->expressionColumn == nullptr ? String::Empty : this->expressionColumn->Expression;
      }

      void set( String^ value )
      {
         if ( expressionColumn == nullptr )
                  AddExpressionColumn( value );
         else
                  expressionColumn->Expression = value;

         if ( expressionColumn != nullptr && expressionColumn->Expression->Equals( value ) )
                  return;

         Invalidate();
      }
   }

private:
   void AddExpressionColumn( String^ value )
   {
      // Get the grid's data source. First check for a 0 
      // table or data grid.
      if ( this->DataGridTableStyle == nullptr || this->DataGridTableStyle->DataGrid == nullptr )
            return;

      DataGrid^ myGrid = this->DataGridTableStyle->DataGrid;
      DataView^ myDataView = dynamic_cast<DataView^>((dynamic_cast<CurrencyManager^>(myGrid->BindingContext[ myGrid->DataSource,myGrid->DataMember ]))->List);

      // This works only with System::Data::DataTable.
      if ( myDataView == nullptr )
            return;

      // If the user already added a column with the name 
      // then exit. Otherwise, add the column and set the 
      // expression to the value passed to this function.
      DataColumn^ col = myDataView->Table->Columns[ "__Computed__Column__" ];
      if ( col != nullptr )
            return;

      col = gcnew DataColumn( String::Concat( "__Computed__Column__", count ) );
      myDataView->Table->Columns->Add( col );
      col->Expression = value;
      expressionColumn = col;
   }

   //  the OnPaint method to paint the cell based on the expression.
protected:
   virtual void Paint( Graphics^ g, Rectangle bounds, CurrencyManager^ source, int rowNum, Brush^ backBrush, Brush^ foreBrush, bool alignToRight ) override
   {
      bool trueExpression = false;
      bool hasExpression = false;
      DataRowView^ drv = dynamic_cast<DataRowView^>(source->List[ rowNum ]);
      hasExpression = this->expressionColumn != nullptr && this->expressionColumn->Expression != nullptr &&  !this->expressionColumn->Expression->Equals( String::Empty );
      Console::WriteLine( String::Format( "hasExpressionValue {0}", hasExpression ) );

      // Get the value from the expression column.
      // For simplicity, we assume a True/False value for the 
      // expression column.
      if ( hasExpression )
      {
         Object^ expr = drv->Row[ expressionColumn->ColumnName ];
         trueExpression = expr->Equals( "True" );
      }

      // Let the DataGridBoolColumn do the painting.
      if (  !hasExpression )
            DataGridBoolColumn::Paint( g, bounds, source, rowNum, backBrush, foreBrush, alignToRight );

      // Paint using the expression color for true or false, as calculated.
      if ( trueExpression )
            DataGridBoolColumn::Paint( g, bounds, source, rowNum, trueBrush, foreBrush, alignToRight );
      else
            DataGridBoolColumn::Paint( g, bounds, source, rowNum, falseBrush, foreBrush, alignToRight );
   }
};

public ref class MyForm: public Form
{
private:
   DataTable^ myTable;
   DataGrid^ myGrid;

public:
   MyForm()
   {
      myGrid = gcnew DataGrid;
      try
      {
         InitializeComponent();
         myTable = gcnew DataTable( "NamesTable" );
         myTable->Columns->Add( gcnew DataColumn( "Name" ) );
         DataColumn^ column = gcnew DataColumn( "id",Int32::typeid );
         myTable->Columns->Add( column );
         myTable->Columns->Add( gcnew DataColumn( "calculatedField",bool::typeid ) );
         DataSet^ namesDataSet = gcnew DataSet;
         namesDataSet->Tables->Add( myTable );
         myGrid->SetDataBinding( namesDataSet, "NamesTable" );
         AddTableStyle();
         AddData();
      }
      catch ( System::Exception^ exc ) 
      {
         Console::WriteLine( exc );
      }
   }

private:
   void grid_Enter( Object^ sender, EventArgs^ e )
   {
      myGrid->CurrentCell = DataGridCell(2,2);
   }

   void AddTableStyle()
   {
      // Map a new  TableStyle to the DataTable. Then 
      // add DataGridColumnStyle objects to the collection
      // of column styles with appropriate mappings.
      DataGridTableStyle^ dgt = gcnew DataGridTableStyle;
      dgt->MappingName = "NamesTable";
      DataGridTextBoxColumn^ dgtbc = gcnew DataGridTextBoxColumn;
      dgtbc->MappingName = "Name";
      dgtbc->HeaderText = "Name";
      dgt->GridColumnStyles->Add( dgtbc );
      dgtbc = gcnew DataGridTextBoxColumn;
      dgtbc->MappingName = "id";
      dgtbc->HeaderText = "id";
      dgt->GridColumnStyles->Add( dgtbc );
      DataGridBoolColumnInherit^ db = gcnew DataGridBoolColumnInherit;
      db->HeaderText = "less than 1000 = blue";
      db->Width = 150;
      db->MappingName = "calculatedField";
      dgt->GridColumnStyles->Add( db );
      myGrid->TableStyles->Add( dgt );

      // This expression instructs the grid to change
      // the color of the inherited DataGridBoolColumn
      // according to the value of the id field. If it's
      // less than 1000, the row is blue. Otherwise,
      // the color is yellow.
      db->Expression = "id < 1000";
   }

   void AddData()
   {
      // Add data with varying numbers for the id field.
      // If the number is over 1000, the cell will paint
      // yellow. Otherwise, it will be blue.
      DataRow^ dRow = myTable->NewRow();
      dRow[ "Name" ] = "name 1 ";
      dRow[ "id" ] = 999;
      myTable->Rows->Add( dRow );
      dRow = myTable->NewRow();
      dRow[ "Name" ] = "name 2";
      dRow[ "id" ] = 2300;
      myTable->Rows->Add( dRow );
      dRow = myTable->NewRow();
      dRow[ "Name" ] = "name 3";
      dRow[ "id" ] = 120;
      myTable->Rows->Add( dRow );
      dRow = myTable->NewRow();
      dRow[ "Name" ] = "name 4";
      dRow[ "id" ] = 4023;
      myTable->Rows->Add( dRow );
      dRow = myTable->NewRow();
      dRow[ "Name" ] = "name 5";
      dRow[ "id" ] = 2345;
      myTable->Rows->Add( dRow );
      myTable->AcceptChanges();
   }

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

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

public class MyForm : Form 
{
    private DataTable myTable;
    private DataGrid myGrid = new DataGrid();
    
    public MyForm() : base() 
    {
        try
        {
            InitializeComponent();

            myTable = new DataTable("NamesTable");
            myTable.Columns.Add(new DataColumn("Name"));
            DataColumn column = new DataColumn
                ("id", typeof(System.Int32));
            myTable.Columns.Add(column);
            myTable.Columns.Add(new 
                DataColumn("calculatedField", typeof(bool)));
            DataSet namesDataSet = new DataSet();
            namesDataSet.Tables.Add(myTable);
            myGrid.SetDataBinding(namesDataSet, "NamesTable");
        
            AddTableStyle();
            AddData();
        }
        catch (System.Exception exc)
        {
            Console.WriteLine(exc.ToString());
        }
    }

    private void grid_Enter(object sender, EventArgs e) 
    {
        myGrid.CurrentCell = new DataGridCell(2,2);
    }

    private void AddTableStyle()
    {
        // Map a new  TableStyle to the DataTable. Then 
        // add DataGridColumnStyle objects to the collection
        // of column styles with appropriate mappings.
        DataGridTableStyle dgt = new DataGridTableStyle();
        dgt.MappingName = "NamesTable";

        DataGridTextBoxColumn dgtbc = new DataGridTextBoxColumn();
        dgtbc.MappingName = "Name";
        dgtbc.HeaderText= "Name";
        dgt.GridColumnStyles.Add(dgtbc);

        dgtbc = new DataGridTextBoxColumn();
        dgtbc.MappingName = "id";
        dgtbc.HeaderText= "id";
        dgt.GridColumnStyles.Add(dgtbc);

        DataGridBoolColumnInherit db = 
            new DataGridBoolColumnInherit();
        db.HeaderText= "less than 1000 = blue";
        db.Width= 150;
        db.MappingName = "calculatedField";
        dgt.GridColumnStyles.Add(db);

        myGrid.TableStyles.Add(dgt);

        // This expression instructs the grid to change
        // the color of the inherited DataGridBoolColumn
        // according to the value of the id field. If it's
        // less than 1000, the row is blue. Otherwise,
        // the color is yellow.
        db.Expression = "id < 1000";
    }

    private void AddData() 
    {
        // Add data with varying numbers for the id field.
        // If the number is over 1000, the cell will paint
        // yellow. Otherwise, it will be blue.
        DataRow dRow = myTable.NewRow();

        dRow["Name"] = "name 1 ";
        dRow["id"] = 999;
        myTable.Rows.Add(dRow);

        dRow = myTable.NewRow();
        dRow["Name"] = "name 2";
        dRow["id"] = 2300;
        myTable.Rows.Add(dRow);

        dRow = myTable.NewRow();
        dRow["Name"] = "name 3";
        dRow["id"] = 120;
        myTable.Rows.Add(dRow);

        dRow = myTable.NewRow();
        dRow["Name"] = "name 4";
        dRow["id"] = 4023;
        myTable.Rows.Add(dRow);

        dRow = myTable.NewRow();
        dRow["Name"] = "name 5";
        dRow["id"] = 2345;
        myTable.Rows.Add(dRow);

        myTable.AcceptChanges();
    }

    private void InitializeComponent() 
    {
        this.Size = new Size(500, 500);
        myGrid.Size = new Size(350, 250);
        myGrid.TabStop = true;
        myGrid.TabIndex = 1;
      
        this.StartPosition = FormStartPosition.CenterScreen;
        this.Controls.Add(myGrid);
      }
    [STAThread]
    public static void Main() 
    {
        Application.Run(new MyForm());
    }
}

public class DataGridBoolColumnInherit : DataGridBoolColumn 
{
    private SolidBrush trueBrush = Brushes.Blue as SolidBrush;
    private SolidBrush falseBrush = Brushes.Yellow as SolidBrush;
    private DataColumn expressionColumn = null;
    private static int count = 0;

    public Color FalseColor 
    {
        get 
        {
            return falseBrush.Color;
        }
        set 
        {
            falseBrush = new SolidBrush(value);
            Invalidate();
        }
    }

    public Color TrueColor 
    {
        get 
        {
            return trueBrush.Color;
        }
        set 
        {
            trueBrush = new SolidBrush(value);
            Invalidate();
        }
    }

    public DataGridBoolColumnInherit() : base () 
    {
        count ++;
    }

    // This will work only with a DataSet or DataTable.
    // The code is not compatible with IBindingList implementations.
    public string Expression 
    {
        get 
        {
            return this.expressionColumn == null ? String.Empty : 
                this.expressionColumn.Expression;
        }
        set 
        {
            if (expressionColumn == null)
                AddExpressionColumn(value);
            else 
                expressionColumn.Expression = value;
            if (expressionColumn != null && 
                expressionColumn.Expression.Equals(value))
                return;
            Invalidate();
        }
    }

    private void AddExpressionColumn(string value) 
    {
        // Get the grid's data source. First check for a null 
        // table or data grid.
        if (this.DataGridTableStyle == null || 
            this.DataGridTableStyle.DataGrid == null)
            return;

        DataGrid myGrid = this.DataGridTableStyle.DataGrid;
        DataView myDataView = ((CurrencyManager) 
            myGrid.BindingContext[myGrid.DataSource, 
            myGrid.DataMember]).List 
            as DataView;

        // This works only with System.Data.DataTable.
        if (myDataView == null)
            return;

        // If the user already added a column with the name 
        // then exit. Otherwise, add the column and set the 
        // expression to the value passed to this function.
        DataColumn col = myDataView.Table.Columns["__Computed__Column__"];
        if (col != null)
            return;
        col = new DataColumn("__Computed__Column__" + count.ToString());

        myDataView.Table.Columns.Add(col);
        col.Expression = value;
        expressionColumn = col;
    }

    // override the OnPaint method to paint the cell based on the expression.
    protected override void Paint(Graphics g, Rectangle bounds,
        CurrencyManager source, int rowNum,
        Brush backBrush, Brush foreBrush,
        bool alignToRight) 
    {
        bool trueExpression = false;
        bool hasExpression = false;
        DataRowView drv = source.List[rowNum] as DataRowView;

        hasExpression = this.expressionColumn != null && 
            this.expressionColumn.Expression != null && 
            !this.expressionColumn.Expression.Equals(String.Empty);

        Console.WriteLine(string.Format("hasExpressionValue {0}",hasExpression));
        // Get the value from the expression column.
        // For simplicity, we assume a True/False value for the 
        // expression column.
        if (hasExpression) 
        {
            object expr = drv.Row[expressionColumn.ColumnName];
            trueExpression = expr.Equals("True");
        }

        // Let the DataGridBoolColumn do the painting.
        if (!hasExpression)
            base.Paint(g, bounds, source, rowNum, 
                backBrush, foreBrush, alignToRight);

        // Paint using the expression color for true or false, as calculated.
        if (trueExpression)
            base.Paint(g, bounds, source, rowNum, 
                trueBrush, foreBrush, alignToRight);
        else
            base.Paint(g, bounds, source, rowNum, 
                falseBrush, foreBrush, alignToRight);
    }
}
Imports System.Data
Imports System.Windows.Forms
Imports System.Drawing
Imports System.ComponentModel

Public Class MyForm
    Inherits System.Windows.Forms.Form
    Private components As System.ComponentModel.Container
    Private myTable As DataTable
    Private myGrid As DataGrid = New DataGrid()

    Public Shared Sub Main()
        Application.Run(New MyForm())
    End Sub

    Public Sub New()
        Try
            InitializeComponent()
            myTable = New DataTable("NamesTable")
            myTable.Columns.Add(New DataColumn("Name"))
            Dim column As DataColumn = New DataColumn _
            ("id", GetType(System.Int32))
            myTable.Columns.Add(column)
            myTable.Columns.Add(New DataColumn _
            ("calculatedField", GetType(Boolean)))
            Dim namesDataSet As DataSet = New DataSet("myDataSet")
            namesDataSet.Tables.Add(myTable)
            myGrid.SetDataBinding(namesDataSet, "NamesTable")
            AddData()
            AddTableStyle()

        Catch exc As System.Exception
            Console.WriteLine(exc.ToString)
        End Try
    End Sub

    Private Sub AddTableStyle()
        ' Map a new  TableStyle to the DataTable. Then 
        ' add DataGridColumnStyle objects to the collection
        ' of column styles with appropriate mappings.
        Dim dgt As DataGridTableStyle = New DataGridTableStyle()
        dgt.MappingName = "NamesTable"

        Dim dgtbc As DataGridTextBoxColumn = _
        New DataGridTextBoxColumn()
        dgtbc.MappingName = "Name"
        dgtbc.HeaderText = "Name"
        dgt.GridColumnStyles.Add(dgtbc)

        dgtbc = New DataGridTextBoxColumn()
        dgtbc.MappingName = "id"
        dgtbc.HeaderText = "id"
        dgt.GridColumnStyles.Add(dgtbc)

        Dim db As DataGridBoolColumnInherit = _
        New DataGridBoolColumnInherit()
        db.HeaderText = "less than 1000 = blue"
        db.Width = 150
        db.MappingName = "calculatedField"
        dgt.GridColumnStyles.Add(db)

        myGrid.TableStyles.Add(dgt)

        ' This expression instructs the grid to change
        ' the color of the inherited DataGridBoolColumn
        ' according to the value of the id field. If it's
        ' less than 1000, the row is blue. Otherwise,
        ' the color is yellow.
        db.Expression = "id < 1000"
    End Sub

    Private Sub AddData()

        ' Add data with varying numbers for the id field.
        ' If the number is over 1000, the cell will paint
        ' yellow. Otherwise, it will be blue.
        Dim dRow As DataRow

        dRow = myTable.NewRow()
        dRow("Name") = "name 1"
        dRow("id") = 999
        myTable.Rows.Add(dRow)

        dRow = myTable.NewRow()
        dRow("Name") = "name 2"
        dRow("id") = 2300
        myTable.Rows.Add(dRow)

        dRow = myTable.NewRow()
        dRow("Name") = "name 3"
        dRow("id") = 120
        myTable.Rows.Add(dRow)

        dRow = myTable.NewRow()
        dRow("Name") = "name 4"
        dRow("id") = 4023
        myTable.Rows.Add(dRow)

        dRow = myTable.NewRow()
        dRow("Name") = "name 5"
        dRow("id") = 2345
        myTable.Rows.Add(dRow)

        myTable.AcceptChanges()
    End Sub

    Private Sub InitializeComponent()
        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

End Class


Public Class DataGridBoolColumnInherit
    Inherits DataGridBoolColumn

    Private trueBrush As SolidBrush = Brushes.Blue
    Private falseBrush As SolidBrush = Brushes.Yellow
    Private expressionColumn As DataColumn = Nothing
    Shared count As Int32 = 0

    Public Property FalseColor() As Color
        Get
            Return falseBrush.Color
        End Get

        Set(ByVal Value As Color)

            falseBrush = New SolidBrush(Value)
            Invalidate()
        End Set
    End Property

    Public Property TrueColor() As Color
        Get
            Return trueBrush.Color
        End Get

        Set(ByVal Value As Color)

            trueBrush = New SolidBrush(Value)
            Invalidate()
        End Set
    End Property

    Public Sub New()
        count += 1
    End Sub

    ' This will work only with a DataSet or DataTable.
    ' The code is not compatible with IBindingList implementations.
    Public Property Expression() As String
        Get
            If Me.expressionColumn Is Nothing Then
                Return String.Empty
            Else
                Return Me.expressionColumn.Expression
            End If
        End Get
        Set(ByVal Value As String)
            If expressionColumn Is Nothing Then
                AddExpressionColumn(Value)
            Else
                expressionColumn.Expression = Value
            End If
            If (expressionColumn IsNot Nothing) And expressionColumn.Expression.Equals(Value) Then
                Return
            End If
            Invalidate()
        End Set
    End Property

    Private Sub AddExpressionColumn(ByVal value As String)
        ' Get the grid's data source. First check for a null 
        ' table or data grid.
        If Me.DataGridTableStyle Is Nothing Or _
        Me.DataGridTableStyle.DataGrid Is Nothing Then
            Return
        End If

        Dim dg As DataGrid = Me.DataGridTableStyle.DataGrid
        Dim dv As DataView = CType(dg.BindingContext(dg.DataSource, dg.DataMember), CurrencyManager).List

        ' This works only with System.Data.DataTable.
        If dv Is Nothing Then
            Return
        End If

        ' If the user already added a column with the name 
        ' then exit. Otherwise, add the column and set the 
        ' expression to the value passed to this function.
        Dim col As DataColumn = dv.Table.Columns("__Computed__Column__")
        If (col IsNot Nothing) Then
            Return
        End If
        col = New DataColumn("__Computed__Column__" + count.ToString())

        dv.Table.Columns.Add(col)

        col.Expression = value
        expressionColumn = col
    End Sub


    ' Override the OnPaint method to paint the cell based on the expression.
    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 trueExpression As Boolean = False
        Dim hasExpression As Boolean = False
        Dim drv As DataRowView = [source].List(rowNum)
        hasExpression = (Me.expressionColumn IsNot Nothing) And (Me.expressionColumn.Expression IsNot Nothing) And Not Me.expressionColumn.Expression.Equals([String].Empty)

        ' Get the value from the expression column.
        ' For simplicity, we assume a True/False value for the 
        ' expression column.
        If hasExpression Then
            Dim expr As Object = drv.Row(expressionColumn.ColumnName)
            trueExpression = expr.Equals("True")
        End If

        ' Let the DataGridBoolColumn do the painting.
        If Not hasExpression Then
            MyBase.Paint(g, bounds, [source], rowNum, backBrush, foreBrush, alignToRight)
        End If

        ' Paint using the expression color for true or false, as calculated.
        If trueExpression Then
            MyBase.Paint(g, bounds, [source], rowNum, trueBrush, foreBrush, alignToRight)
        Else
            MyBase.Paint(g, bounds, [source], rowNum, falseBrush, foreBrush, alignToRight)
        End If
    End Sub
End Class

注釈

DataGridBoolColumnは、abstract クラス DataGridColumnStyleから派生します。 実行時に、 DataGridBoolColumn には、既定でチェック (true)、オフ (false)、 Valueの 3 つの状態を持つチェック ボックスが各セルに含まれます。 2 状態のチェック ボックスを使用するには、 AllowNull プロパティを false に設定します。

クラスに追加されるプロパティには、 FalseValueNullValue、および TrueValueが含まれます。 これらのプロパティは、各列の状態の基になる値を指定します。

コンストラクター

名前 説明
DataGridBoolColumn()
古い.

DataGridBoolColumn クラスの新しいインスタンスを初期化します。

DataGridBoolColumn(PropertyDescriptor, Boolean)
古い.

指定したPropertyDescriptorを使用して、列スタイルが既定の列であるかどうかを指定して、DataGridBoolColumn クラスの新しいインスタンスを初期化します。

DataGridBoolColumn(PropertyDescriptor)
古い.

指定したDataGridBoolColumnを使用して、PropertyDescriptor クラスの新しいインスタンスを初期化します。

プロパティ

名前 説明
Alignment
古い.

列内のテキストの配置を取得または設定します。

(継承元 DataGridColumnStyle)
AllowNull
古い.

null 値が許可されるかどうかを示す値を取得または設定します。

CanRaiseEvents
古い.

コンポーネントがイベントを発生できるかどうかを示す値を取得します。

(継承元 Component)
Container
古い.

IContainerを含むComponentを取得します。

(継承元 Component)
DataGridTableStyle
古い.

列の DataGridTableStyle を取得します。

(継承元 DataGridColumnStyle)
DesignMode
古い.

Componentが現在デザイン モードであるかどうかを示す値を取得します。

(継承元 Component)
Events
古い.

この Componentにアタッチされているイベント ハンドラーの一覧を取得します。

(継承元 Component)
FalseValue
古い.

列の値を falseに設定するときに使用する実際の値を取得または設定します。

FontHeight
古い.

列のフォントの高さを取得します。

(継承元 DataGridColumnStyle)
HeaderAccessibleObject
古い.

列の AccessibleObject を取得します。

(継承元 DataGridColumnStyle)
HeaderText
古い.

列ヘッダーのテキストを取得または設定します。

(継承元 DataGridColumnStyle)
MappingName
古い.

列スタイルをマップするデータ メンバーの名前を取得または設定します。

(継承元 DataGridColumnStyle)
NullText
古い.

列に nullが含まれているときに表示されるテキストを取得または設定します。

(継承元 DataGridColumnStyle)
NullValue
古い.

列の値を Valueに設定するときに使用する実際の値を取得または設定します。

PropertyDescriptor
古い.

DataGridColumnStyleによって表示されるデータの属性を決定するPropertyDescriptorを取得または設定します。

(継承元 DataGridColumnStyle)
ReadOnly
古い.

列のデータを編集できるかどうかを示す値を取得または設定します。

(継承元 DataGridColumnStyle)
Site
古い.

ISiteComponentを取得または設定します。

(継承元 Component)
TrueValue
古い.

列の値を trueに設定するときに使用する実際の値を取得または設定します。

Width
古い.

列の幅を取得または設定します。

(継承元 DataGridColumnStyle)

メソッド

名前 説明
Abort(Int32)
古い.

編集プロシージャを中断する要求を開始します。

BeginUpdate()
古い.

EndUpdate() メソッドが呼び出されるまで、列の描画を中断します。

(継承元 DataGridColumnStyle)
CheckValidDataSource(CurrencyManager)
古い.

DataGridに有効なデータ ソースがない場合、またはこの列がデータ ソースの有効なプロパティにマップされていない場合は、例外をスローします。

(継承元 DataGridColumnStyle)
ColumnStartedEditing(Control)
古い.

ユーザーが列の編集を開始したことを DataGrid に通知します。

(継承元 DataGridColumnStyle)
Commit(CurrencyManager, Int32)
古い.

編集手順を完了するための要求を開始します。

ConcedeFocus()
古い.

ホストしているコントロールにフォーカスを放棄する必要があることを列に通知します。

ConcedeFocus()
古い.

ホストしているコントロールにフォーカスを放棄する必要があることを列に通知します。

(継承元 DataGridColumnStyle)
CreateHeaderAccessibleObject()
古い.

列の AccessibleObject を取得します。

(継承元 DataGridColumnStyle)
CreateObjRef(Type)
古い.

リモート オブジェクトとの通信に使用されるプロキシの生成に必要なすべての関連情報を含むオブジェクトを作成します。

(継承元 MarshalByRefObject)
Dispose()
古い.

Componentによって使用されるすべてのリソースを解放します。

(継承元 Component)
Dispose(Boolean)
古い.

Componentによって使用されるアンマネージ リソースを解放し、必要に応じてマネージド リソースを解放します。

(継承元 Component)
Edit(CurrencyManager, Int32, Rectangle, Boolean, String, Boolean)
古い.

値を編集するためのセルを準備します。

Edit(CurrencyManager, Int32, Rectangle, Boolean, String)
古い.

指定した CurrencyManager、行番号、および Rectangle パラメーターを使用して、編集用のセルを準備します。

(継承元 DataGridColumnStyle)
Edit(CurrencyManager, Int32, Rectangle, Boolean)
古い.

セルを編集用に準備します。

(継承元 DataGridColumnStyle)
EndUpdate()
古い.

BeginUpdate() メソッドを呼び出して、中断された列の描画を再開します。

(継承元 DataGridColumnStyle)
EnterNullValue()
古い.

列に Value を入力します。

EnterNullValue()
古い.

列に Value を入力します。

(継承元 DataGridColumnStyle)
Equals(Object)
古い.

指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetColumnValueAtRow(CurrencyManager, Int32)
古い.

指定した行の値を取得します。

GetColumnValueAtRow(CurrencyManager, Int32)
古い.

指定した CurrencyManagerから、指定した行の値を取得します。

(継承元 DataGridColumnStyle)
GetHashCode()
古い.

既定のハッシュ関数として機能します。

(継承元 Object)
GetLifetimeService()
古い.

このインスタンスの有効期間ポリシーを制御する現在の有効期間サービス オブジェクトを取得します。

(継承元 MarshalByRefObject)
GetMinimumHeight()
古い.

列内のセルの高さを取得します。

GetPreferredHeight(Graphics, Object)
古い.

列のサイズを変更するときに使用する高さを取得します。

GetPreferredSize(Graphics, Object)
古い.

含める特定の値を指定して、セルの最適な幅と高さを取得します。

GetService(Type)
古い.

ComponentまたはそのContainerによって提供されるサービスを表すオブジェクトを返します。

(継承元 Component)
GetType()
古い.

現在のインスタンスの Type を取得します。

(継承元 Object)
InitializeLifetimeService()
古い.

このインスタンスの有効期間ポリシーを制御する有効期間サービス オブジェクトを取得します。

(継承元 MarshalByRefObject)
Invalidate()
古い.

列を再描画し、描画メッセージをコントロールに送信します。

(継承元 DataGridColumnStyle)
MemberwiseClone()
古い.

現在の Objectの簡易コピーを作成します。

(継承元 Object)
MemberwiseClone(Boolean)
古い.

現在の MarshalByRefObject オブジェクトの簡易コピーを作成します。

(継承元 MarshalByRefObject)
Paint(Graphics, Rectangle, CurrencyManager, Int32, Boolean)
古い.

指定したGraphicsRectangle、行番号、および配置設定でDataGridBoolColumnを描画します。

Paint(Graphics, Rectangle, CurrencyManager, Int32, Brush, Brush, Boolean)
古い.

指定したGraphicsRectangle、行番号、Brush、およびColorDataGridBoolColumnを描画します。

Paint(Graphics, Rectangle, CurrencyManager, Int32, Brush, Brush, Boolean)
古い.

指定したGraphicsRectangleCurrencyManager、行番号、背景色、前景色、および配置を使用して、DataGridColumnStyleを描画します。

(継承元 DataGridColumnStyle)
Paint(Graphics, Rectangle, CurrencyManager, Int32)
古い.

指定したGraphicsRectangle、行番号を使用してDataGridBoolColumnを描画します。

ReleaseHostedControl()
古い.

ホストするコントロールが不要な場合に、列がリソースを解放できるようにします。

(継承元 DataGridColumnStyle)
ResetHeaderText()
古い.

HeaderTextを既定値のnullにリセットします。

(継承元 DataGridColumnStyle)
SetColumnValueAtRow(CurrencyManager, Int32, Object)
古い.

指定した行の値を設定します。

SetColumnValueAtRow(CurrencyManager, Int32, Object)
古い.

指定した CurrencyManagerの値を使用して、指定した行の値を設定します。

(継承元 DataGridColumnStyle)
SetDataGrid(DataGrid)
古い.

この列が属する DataGrid コントロールを設定します。

(継承元 DataGridColumnStyle)
SetDataGridInColumn(DataGrid)
古い.

列の DataGrid を設定します。

(継承元 DataGridColumnStyle)
ToString()
古い.

Stringの名前 (存在する場合) を含むComponentを返します。 このメソッドはオーバーライドしないでください。

(継承元 Component)
UpdateUI(CurrencyManager, Int32, String)
古い.

指定したテキストを使用して、指定した行の値を更新します。

(継承元 DataGridColumnStyle)

イベント

名前 説明
AlignmentChanged
古い.

Alignment プロパティ値が変更されたときに発生します。

(継承元 DataGridColumnStyle)
AllowNullChanged
古い.

AllowNull プロパティが変更されたときに発生します。

Disposed
古い.

コンポーネントが Dispose() メソッドの呼び出しによって破棄されるときに発生します。

(継承元 Component)
FalseValueChanged
古い.

FalseValue プロパティが変更されたときに発生します。

FontChanged
古い.

列のフォントが変更されたときに発生します。

(継承元 DataGridColumnStyle)
HeaderTextChanged
古い.

HeaderText プロパティ値が変更されたときに発生します。

(継承元 DataGridColumnStyle)
MappingNameChanged
古い.

MappingName値が変更されたときに発生します。

(継承元 DataGridColumnStyle)
NullTextChanged
古い.

NullText値が変更されたときに発生します。

(継承元 DataGridColumnStyle)
PropertyDescriptorChanged
古い.

PropertyDescriptor プロパティ値が変更されたときに発生します。

(継承元 DataGridColumnStyle)
ReadOnlyChanged
古い.

ReadOnly プロパティ値が変更されたときに発生します。

(継承元 DataGridColumnStyle)
TrueValueChanged
古い.

TrueValue プロパティ値が変更されたときに発生します。

WidthChanged
古い.

Width プロパティ値が変更されたときに発生します。

(継承元 DataGridColumnStyle)

明示的なインターフェイスの実装

名前 説明
IDataGridColumnStyleEditingNotificationService.ColumnStartedEditing(Control)
古い.

ユーザーが列の編集を開始したことを DataGrid コントロールに通知します。

(継承元 DataGridColumnStyle)

適用対象

こちらもご覧ください