DataGridViewCheckBoxColumn.FlatStyle Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Obtém ou define o aspeto plano das células de caixa de seleção.
public:
property System::Windows::Forms::FlatStyle FlatStyle { System::Windows::Forms::FlatStyle get(); void set(System::Windows::Forms::FlatStyle value); };
public System.Windows.Forms.FlatStyle FlatStyle { get; set; }
member this.FlatStyle : System.Windows.Forms.FlatStyle with get, set
Public Property FlatStyle As FlatStyle
Valor de Propriedade
Um valor que FlatStyle indica o aparecimento das células na coluna. A predefinição é Standard.
Exceções
O valor da CellTemplate propriedade é null.
Exemplos
O seguinte exemplo de código demonstra como usar a DataGridViewCheckBoxColumn para assinalar quais os funcionários que estão fora do escritório. Este exemplo faz parte de um exemplo mais amplo disponível no DataGridViewComboBoxColumn tópico de visão geral da aula.
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);
}
private void AddOutOfOfficeColumn()
{
DataGridViewCheckBoxColumn column = new DataGridViewCheckBoxColumn();
{
column.HeaderText = ColumnName.OutOfOffice.ToString();
column.Name = ColumnName.OutOfOffice.ToString();
column.AutoSizeMode =
DataGridViewAutoSizeColumnMode.DisplayedCells;
column.FlatStyle = FlatStyle.Standard;
column.ThreeState = true;
column.CellTemplate = new DataGridViewCheckBoxCell();
column.CellTemplate.Style.BackColor = Color.Beige;
}
DataGridView1.Columns.Insert(0, column);
}
Private Sub AddOutOfOfficeColumn()
Dim column As New DataGridViewCheckBoxColumn()
With column
.HeaderText = ColumnName.OutOfOffice.ToString()
.Name = ColumnName.OutOfOffice.ToString()
.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells
.FlatStyle = FlatStyle.Standard
.CellTemplate = New DataGridViewCheckBoxCell()
.CellTemplate.Style.BackColor = Color.Beige
End With
DataGridView1.Columns.Insert(0, column)
End Sub
Observações
Para mostrar as células da caixa de seleção usando estilos visuais, defina esta propriedade para System e chame o Application.EnableVisualStyles método antes Application.Runde .
Obter ou definir esta propriedade obtém ou define a FlatStyle propriedade do objeto célula devolvido pela CellTemplate propriedade. Definir esta propriedade também define a FlatStyle propriedade de cada célula da coluna e atualiza o ecrã da coluna. Para sobrescrever o valor especificado para células individuais, defina os valores das células depois de definir o valor da coluna.