DataGridViewCheckBoxCell::FlatStyle Property
.NET Framework (current version)
Gets or sets the flat style appearance of the check box user interface (UI).
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
| Exception | Condition |
|---|---|
| InvalidEnumArgumentException | The specified value when setting this property is not a valid FlatStyle value. |
The Popup flat style is not supported by this cell type.
Setting the FlatStyle property of the owning column also sets the FlatStyle property of every cell in the column and refreshes the column display. To override the specified value for individual cells, set the cell values after you set the column value.
The following code example demonstrates the use of the DataGridViewCheckBoxColumn::FlatStyle property, which is similar to this property. This example is part of a larger example available in the DataGridViewComboBoxColumn class overview topic.
private: void AddOutOfOfficeColumn() { DataGridViewCheckBoxColumn^ column = gcnew DataGridViewCheckBoxColumn(); { column->HeaderText = ColumnName::OutOfOffice.ToString(); column->Name = ColumnName::OutOfOffice.ToString(); column->AutoSizeMode = DataGridViewAutoSizeColumnMode::DisplayedCells; column->FlatStyle = FlatStyle::Standard; column->ThreeState = true; column->CellTemplate = gcnew DataGridViewCheckBoxCell(); column->CellTemplate->Style->BackColor = Color::Beige; } DataGridView1->Columns->Insert(0, column); }
.NET Framework
Available since 2.0
Available since 2.0
Show: