Condividi tramite


DataGridBoolColumn Classe

Definizione

Attenzione

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

Specifica una colonna in cui ogni cella contiene una casella di controllo per rappresentare un valore booleano.

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
Ereditarietà
Attributi

Esempio

Nell'esempio di codice seguente viene prima creato un nuovo DataGridBoolColumn oggetto e viene aggiunto all'oggetto GridColumnStylesCollection di un oggetto DataGridTableStyle.

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

Commenti

Deriva DataGridBoolColumn dalla abstract classe DataGridColumnStyle. In fase di esecuzione, le DataGridBoolColumn caselle di controllo contengono le caselle di controllo in ogni cella con tre stati per impostazione predefinita: selezionata (true), deselezionata (false) e Value. Per utilizzare caselle di controllo a due stati, impostare la AllowNull proprietà su false.

Le proprietà aggiunte alla classe includono FalseValue, NullValuee TrueValue. Queste proprietà specificano il valore sottostante a ognuno degli stati della colonna.

Costruttori

Nome Descrizione
DataGridBoolColumn()
Obsoleti.

Inizializza una nuova istanza della classe DataGridBoolColumn.

DataGridBoolColumn(PropertyDescriptor, Boolean)
Obsoleti.

Inizializza una nuova istanza della classe con l'oggetto DataGridBoolColumn specificato PropertyDescriptore specifica se lo stile della colonna è una colonna predefinita.

DataGridBoolColumn(PropertyDescriptor)
Obsoleti.

Inizializza una nuova istanza della DataGridBoolColumn classe con l'oggetto specificato PropertyDescriptor.

Proprietà

Nome Descrizione
Alignment
Obsoleti.

Ottiene o imposta l'allineamento del testo in una colonna.

(Ereditato da DataGridColumnStyle)
AllowNull
Obsoleti.

Ottiene o imposta un valore che indica se sono consentiti valori Null.

CanRaiseEvents
Obsoleti.

Ottiene un valore che indica se il componente può generare un evento.

(Ereditato da Component)
Container
Obsoleti.

Ottiene l'oggetto IContainer contenente l'oggetto Component.

(Ereditato da Component)
DataGridTableStyle
Obsoleti.

Ottiene l'oggetto DataGridTableStyle per la colonna.

(Ereditato da DataGridColumnStyle)
DesignMode
Obsoleti.

Ottiene un valore che indica se è Component attualmente in modalità progettazione.

(Ereditato da Component)
Events
Obsoleti.

Ottiene l'elenco dei gestori eventi associati a questo Componentoggetto .

(Ereditato da Component)
FalseValue
Obsoleti.

Ottiene o imposta il valore effettivo utilizzato quando si imposta il valore della colonna su false.

FontHeight
Obsoleti.

Ottiene l'altezza del tipo di carattere della colonna.

(Ereditato da DataGridColumnStyle)
HeaderAccessibleObject
Obsoleti.

Ottiene l'oggetto AccessibleObject per la colonna.

(Ereditato da DataGridColumnStyle)
HeaderText
Obsoleti.

Ottiene o imposta il testo dell'intestazione di colonna.

(Ereditato da DataGridColumnStyle)
MappingName
Obsoleti.

Ottiene o imposta il nome del membro dati in cui eseguire il mapping dello stile della colonna.

(Ereditato da DataGridColumnStyle)
NullText
Obsoleti.

Ottiene o imposta il testo visualizzato quando la colonna contiene null.

(Ereditato da DataGridColumnStyle)
NullValue
Obsoleti.

Ottiene o imposta il valore effettivo utilizzato quando si imposta il valore della colonna su Value.

PropertyDescriptor
Obsoleti.

Ottiene o imposta l'oggetto PropertyDescriptor che determina gli attributi dei dati visualizzati da DataGridColumnStyle.

(Ereditato da DataGridColumnStyle)
ReadOnly
Obsoleti.

Ottiene o imposta un valore che indica se i dati nella colonna possono essere modificati.

(Ereditato da DataGridColumnStyle)
Site
Obsoleti.

Ottiene o imposta l'oggetto ISite dell'oggetto Component.

(Ereditato da Component)
TrueValue
Obsoleti.

Ottiene o imposta il valore effettivo utilizzato quando si imposta il valore della colonna su true.

Width
Obsoleti.

Ottiene o imposta la larghezza della colonna.

(Ereditato da DataGridColumnStyle)

Metodi

Nome Descrizione
Abort(Int32)
Obsoleti.

Avvia una richiesta per interrompere una procedura di modifica.

BeginUpdate()
Obsoleti.

Sospende il disegno della colonna fino a quando non viene chiamato il EndUpdate() metodo .

(Ereditato da DataGridColumnStyle)
CheckValidDataSource(CurrencyManager)
Obsoleti.

Genera un'eccezione se l'oggetto non dispone di un'origine DataGrid dati valida o se questa colonna non è mappata a una proprietà valida nell'origine dati.

(Ereditato da DataGridColumnStyle)
ColumnStartedEditing(Control)
Obsoleti.

Informa che DataGrid l'utente ha iniziato a modificare la colonna.

(Ereditato da DataGridColumnStyle)
Commit(CurrencyManager, Int32)
Obsoleti.

Avvia una richiesta per completare una procedura di modifica.

ConcedeFocus()
Obsoleti.

Notifica a una colonna che deve rinunciare allo stato attivo per il controllo che ospita.

ConcedeFocus()
Obsoleti.

Notifica a una colonna che deve rinunciare allo stato attivo per il controllo che ospita.

(Ereditato da DataGridColumnStyle)
CreateHeaderAccessibleObject()
Obsoleti.

Ottiene l'oggetto AccessibleObject per la colonna.

(Ereditato da DataGridColumnStyle)
CreateObjRef(Type)
Obsoleti.

Crea un oggetto che contiene tutte le informazioni pertinenti necessarie per generare un proxy utilizzato per comunicare con un oggetto remoto.

(Ereditato da MarshalByRefObject)
Dispose()
Obsoleti.

Rilascia tutte le risorse usate da Component.

(Ereditato da Component)
Dispose(Boolean)
Obsoleti.

Rilascia le risorse non gestite usate da Component e, facoltativamente, rilascia le risorse gestite.

(Ereditato da Component)
Edit(CurrencyManager, Int32, Rectangle, Boolean, String, Boolean)
Obsoleti.

Prepara la cella per la modifica di un valore.

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

Prepara la cella per la modifica usando i parametri , il numero di riga e Rectangle i parametri specificatiCurrencyManager.

(Ereditato da DataGridColumnStyle)
Edit(CurrencyManager, Int32, Rectangle, Boolean)
Obsoleti.

Prepara una cella per la modifica.

(Ereditato da DataGridColumnStyle)
EndUpdate()
Obsoleti.

Riprende il disegno delle colonne sospese chiamando il BeginUpdate() metodo .

(Ereditato da DataGridColumnStyle)
EnterNullValue()
Obsoleti.

Inserisce un oggetto Value nella colonna .

EnterNullValue()
Obsoleti.

Inserisce un oggetto Value nella colonna .

(Ereditato da DataGridColumnStyle)
Equals(Object)
Obsoleti.

Determina se l'oggetto specificato è uguale all'oggetto corrente.

(Ereditato da Object)
GetColumnValueAtRow(CurrencyManager, Int32)
Obsoleti.

Ottiene il valore in corrispondenza della riga specificata.

GetColumnValueAtRow(CurrencyManager, Int32)
Obsoleti.

Ottiene il valore nella riga specificata dall'oggetto specificato CurrencyManager.

(Ereditato da DataGridColumnStyle)
GetHashCode()
Obsoleti.

Funge da funzione hash predefinita.

(Ereditato da Object)
GetLifetimeService()
Obsoleti.

Recupera l'oggetto servizio di durata corrente che controlla i criteri di durata per questa istanza.

(Ereditato da MarshalByRefObject)
GetMinimumHeight()
Obsoleti.

Ottiene l'altezza di una cella in una colonna.

GetPreferredHeight(Graphics, Object)
Obsoleti.

Ottiene l'altezza utilizzata per il ridimensionamento delle colonne.

GetPreferredSize(Graphics, Object)
Obsoleti.

Ottiene la larghezza e l'altezza ottimali di una cella in base a un valore specifico da contenere.

GetService(Type)
Obsoleti.

Restituisce un oggetto che rappresenta un servizio fornito da Component o da Container.

(Ereditato da Component)
GetType()
Obsoleti.

Ottiene il Type dell'istanza corrente.

(Ereditato da Object)
InitializeLifetimeService()
Obsoleti.

Ottiene un oggetto servizio di durata per controllare i criteri di durata per questa istanza.

(Ereditato da MarshalByRefObject)
Invalidate()
Obsoleti.

Ridisegna la colonna e fa sì che un messaggio di disegno venga inviato al controllo.

(Ereditato da DataGridColumnStyle)
MemberwiseClone()
Obsoleti.

Crea una copia superficiale del Objectcorrente.

(Ereditato da Object)
MemberwiseClone(Boolean)
Obsoleti.

Crea una copia superficiale dell'oggetto corrente MarshalByRefObject .

(Ereditato da MarshalByRefObject)
Paint(Graphics, Rectangle, CurrencyManager, Int32, Boolean)
Obsoleti.

DataGridBoolColumn Disegna con le impostazioni di allineamento , Rectangle, , e numero di riga specificateGraphics.

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

Disegna con l'oggetto GraphicsDataGridBoolColumn specificato , Rectangle, numero di riga, Brushe Color.

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

Disegna un DataGridColumnStyle oggetto con il numero di riga , Rectangle, CurrencyManager, , il colore di sfondo, il colore di primo piano e l'allineamento specificatiGraphics.

(Ereditato da DataGridColumnStyle)
Paint(Graphics, Rectangle, CurrencyManager, Int32)
Obsoleti.

Disegna con DataGridBoolColumn il Graphicsnumero di riga specificato Rectangle e .

ReleaseHostedControl()
Obsoleti.

Consente alla colonna di liberare risorse quando il controllo che ospita non è necessario.

(Ereditato da DataGridColumnStyle)
ResetHeaderText()
Obsoleti.

Reimposta l'oggetto sul HeaderText relativo valore predefinito, null.

(Ereditato da DataGridColumnStyle)
SetColumnValueAtRow(CurrencyManager, Int32, Object)
Obsoleti.

Imposta il valore di una riga specificata.

SetColumnValueAtRow(CurrencyManager, Int32, Object)
Obsoleti.

Imposta il valore in una riga specificata con il valore di un oggetto specificato CurrencyManager.

(Ereditato da DataGridColumnStyle)
SetDataGrid(DataGrid)
Obsoleti.

Imposta il DataGrid controllo a cui appartiene questa colonna.

(Ereditato da DataGridColumnStyle)
SetDataGridInColumn(DataGrid)
Obsoleti.

Imposta l'oggetto DataGrid per la colonna.

(Ereditato da DataGridColumnStyle)
ToString()
Obsoleti.

Restituisce un oggetto String contenente il nome dell'oggetto Component, se presente. Questo metodo non deve essere sottoposto a override.

(Ereditato da Component)
UpdateUI(CurrencyManager, Int32, String)
Obsoleti.

Aggiorna il valore di una riga specificata con il testo specificato.

(Ereditato da DataGridColumnStyle)

Eventi

Nome Descrizione
AlignmentChanged
Obsoleti.

Si verifica quando il valore della Alignment proprietà cambia.

(Ereditato da DataGridColumnStyle)
AllowNullChanged
Obsoleti.

Si verifica quando la AllowNull proprietà viene modificata.

Disposed
Obsoleti.

Si verifica quando il componente viene eliminato da una chiamata al Dispose() metodo .

(Ereditato da Component)
FalseValueChanged
Obsoleti.

Si verifica quando la FalseValue proprietà viene modificata.

FontChanged
Obsoleti.

Si verifica quando cambia il tipo di carattere della colonna.

(Ereditato da DataGridColumnStyle)
HeaderTextChanged
Obsoleti.

Si verifica quando il valore della HeaderText proprietà cambia.

(Ereditato da DataGridColumnStyle)
MappingNameChanged
Obsoleti.

Si verifica quando il MappingName valore cambia.

(Ereditato da DataGridColumnStyle)
NullTextChanged
Obsoleti.

Si verifica quando il NullText valore cambia.

(Ereditato da DataGridColumnStyle)
PropertyDescriptorChanged
Obsoleti.

Si verifica quando il valore della PropertyDescriptor proprietà cambia.

(Ereditato da DataGridColumnStyle)
ReadOnlyChanged
Obsoleti.

Si verifica quando il valore della ReadOnly proprietà cambia.

(Ereditato da DataGridColumnStyle)
TrueValueChanged
Obsoleti.

Si verifica quando viene modificato il valore della TrueValue proprietà.

WidthChanged
Obsoleti.

Si verifica quando il valore della Width proprietà cambia.

(Ereditato da DataGridColumnStyle)

Implementazioni dell'interfaccia esplicita

Nome Descrizione
IDataGridColumnStyleEditingNotificationService.ColumnStartedEditing(Control)
Obsoleti.

Informa il DataGrid controllo che l'utente ha iniziato a modificare la colonna.

(Ereditato da DataGridColumnStyle)

Si applica a

Vedi anche