Compartilhar via


DataGridViewCheckBoxCell.FlatStyle Propriedade

Definição

Obtém ou define a aparência de estilo plano da interface do usuário da 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 da propriedade

FlatStyle

Um dos valores de FlatStyle. O padrão é Standard.

Exceções

O valor especificado ao definir essa propriedade não é um valor FlatStyle válido.

Exemplos

O exemplo de código a seguir demonstra o uso da DataGridViewCheckBoxColumn.FlatStyle propriedade, que é semelhante a essa propriedade. Este exemplo faz parte de um exemplo maior disponível no tópico de visão geral da DataGridViewComboBoxColumn classe.

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

Comentários

Não Popup há suporte para o estilo simples desse tipo de célula.

Definir a FlatStyle propriedade da coluna proprietária também define a FlatStyle propriedade de cada célula na coluna e atualiza a exibição da coluna. Para substituir o valor especificado para células individuais, defina os valores da célula depois de definir o valor da coluna.

Aplica-se a

Confira também