DataGridView.RowDefaultCellStyleChanged Evento

Definición

Se produce cuando cambia el valor de la propiedad DefaultCellStyle para una fila.

public:
 event System::Windows::Forms::DataGridViewRowEventHandler ^ RowDefaultCellStyleChanged;
public event System.Windows.Forms.DataGridViewRowEventHandler RowDefaultCellStyleChanged;
public event System.Windows.Forms.DataGridViewRowEventHandler? RowDefaultCellStyleChanged;
member this.RowDefaultCellStyleChanged : System.Windows.Forms.DataGridViewRowEventHandler 
Public Custom Event RowDefaultCellStyleChanged As DataGridViewRowEventHandler 

Tipo de evento

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 RowDefaultCellStyleChanged 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 RowDefaultCellStyleChanged evento.

private void DataGridView1_RowDefaultCellStyleChanged(Object sender, DataGridViewRowEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "Row", e.Row );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "RowDefaultCellStyleChanged Event" );
}
Private Sub DataGridView1_RowDefaultCellStyleChanged(sender as Object, e as DataGridViewRowEventArgs) _ 
     Handles DataGridView1.RowDefaultCellStyleChanged

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

End Sub

Comentarios

Este evento se produce cuando cualquier propiedad devuelta DataGridViewCellStyle por la DefaultCellStyle propiedad de una fila se establece en un nuevo valor o cuando la DefaultCellStyle propiedad de una fila se establece en un nuevo DataGridViewCellStyle con al menos un valor de propiedad distinto del objeto de estilo de celda anterior.

Para obtener más información acerca de cómo controlar eventos, vea controlar y provocar eventos.

Se aplica a

Consulte también