DataGridViewCellStyleContentChangedEventArgs.CellStyleScope Propiedad

Definición

Obtiene el ámbito afectado por el estilo de celda cambiado.

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 propiedad

Un objeto DataGridViewCellStyleScopes que indica qué entidad DataGridView posee el estilo de celda que ha cambiado.

Ejemplos

En el ejemplo de código siguiente se muestra el uso de este miembro. En el ejemplo, un controlador de eventos informa sobre la aparición del DataGridView.CellStyleContentChanged evento. Este informe le ayuda a aprender cuándo se produce el evento y puede ayudarle a depurar. Para informar sobre varios eventos o eventos que se producen con frecuencia, considere la posibilidad de reemplazar MessageBox.Show por Console.WriteLine o anexar el mensaje a una línea TextBoxmúltiple.

Para ejecutar el código de ejemplo, péguelo en un proyecto que contenga una instancia de tipo DataGridView denominada DataGridView1. A continuación, asegúrese de que el controlador de eventos está asociado al 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

Comentarios

Utilice la CellStyleScope propiedad para determinar qué propiedad ha DataGridViewCellStyle cambiado. Utilice la CellStyle propiedad para recuperar el valor actualizado.

Se aplica a

Consulte también