DataGridViewCellStyleContentChangedEventArgs.CellStyleScope Propriedade

Definição

Obtém o endoscópio que é afetado pelo estilo alterado da célula.

public:
 property System::Windows::Forms::DataGridViewCellStyleScopes CellStyleScope { System::Windows::Forms::DataGridViewCellStyleScopes get(); };
public System.Windows.Forms.DataGridViewCellStyleScopes CellStyleScope { get; }
member this.CellStyleScope : System.Windows.Forms.DataGridViewCellStyleScopes
Public ReadOnly Property CellStyleScope As DataGridViewCellStyleScopes

Valor de Propriedade

A DataGridViewCellStyleScopes que indica qual DataGridView entidade possui o estilo de célula que mudou.

Exemplos

O seguinte exemplo de código demonstra a utilização deste elemento. No exemplo, um gestor de eventos reporta a ocorrência do DataGridView.CellStyleContentChanged evento. Este relatório ajuda-o a saber quando o evento ocorre e pode ajudá-lo na depuração. Para reportar múltiplos eventos ou eventos que ocorrem frequentemente, considere substituir MessageBox.Show ou Console.WriteLine anexar a mensagem a uma multilinha TextBox.

Para executar o código de exemplo, cole-o num projeto que contenha uma instância do tipo DataGridView chamada DataGridView1. Depois, certifique-se de que o gestor de eventos está associado ao DataGridView.CellStyleContentChanged evento.

private void DataGridView1_CellStyleContentChanged(Object sender, DataGridViewCellStyleContentChangedEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "CellStyle", e.CellStyle );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "CellStyleScope", e.CellStyleScope );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "CellStyleContentChanged Event" );
}
Private Sub DataGridView1_CellStyleContentChanged(sender as Object, e as DataGridViewCellStyleContentChangedEventArgs) _ 
     Handles DataGridView1.CellStyleContentChanged

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "CellStyle", e.CellStyle)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "CellStyleScope", e.CellStyleScope)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"CellStyleContentChanged Event")

End Sub

Observações

Use a CellStyleScope propriedade para determinar qual das DataGridViewCellStyle propriedades foi alterada. Use a CellStyle propriedade para recuperar o valor atualizado.

Aplica-se a

Ver também