DataGridView.AutoSizeRowsModeChanged Evento

Definición

Se produce cuando cambia el valor de la propiedad DataGridViewAutoSizeRowsMode.Occurs when the value of the DataGridViewAutoSizeRowsMode property changes.

public:
 event System::Windows::Forms::DataGridViewAutoSizeModeEventHandler ^ AutoSizeRowsModeChanged;
public event System.Windows.Forms.DataGridViewAutoSizeModeEventHandler AutoSizeRowsModeChanged;
member this.AutoSizeRowsModeChanged : System.Windows.Forms.DataGridViewAutoSizeModeEventHandler 
Public Custom Event AutoSizeRowsModeChanged As DataGridViewAutoSizeModeEventHandler 

Ejemplos

En el ejemplo de código siguiente se muestra el uso de este evento.The following code example illustrates the use of this event. Este ejemplo forma parte de un ejemplo más grande disponible en [How para: Cambiar automáticamente el tamaño de las celdas cuando cambia el contenido en el control DataGridView Windows Forms @ no__t-0.This example is part of a larger example available in How to: Automatically Resize Cells When Content Changes in the Windows Forms DataGridView Control.

void WatchRowsModeChanges( Object^ /*sender*/, DataGridViewAutoSizeModeEventArgs^ modeEvent )
{
   Label^ label = dynamic_cast<Label^>(flowLayoutPanel1->Controls[ currentLayoutName ]);
   if ( modeEvent->PreviousModeAutoSized )
   {
      label->Text = String::Format( "changed to a different {0}{1}", label->Name, dataGridView1->AutoSizeRowsMode );
   }
   else
   {
      label->Text = String::Concat( label->Name, dataGridView1->AutoSizeRowsMode );
   }
}


private void WatchRowsModeChanges(object sender,
    DataGridViewAutoSizeModeEventArgs modeEvent)
{
    Label label =
        (Label)flowLayoutPanel1.Controls[currentLayoutName];

    if (modeEvent.PreviousModeAutoSized)
    {
        label.Text = "changed to a different " +
            label.Name +
            dataGridView1.AutoSizeRowsMode.ToString();
    }
    else
    {
        label.Text = label.Name +
            dataGridView1.AutoSizeRowsMode.ToString();
    }
}
Private Sub WatchRowsModeChanges(ByVal sender As Object, _
    ByVal modeEvent As DataGridViewAutoSizeModeEventArgs) _
    Handles DataGridView1.AutoSizeRowsModeChanged

    Dim label As Label = CType(FlowLayoutPanel1.Controls _
        (currentLayoutName), Label)

    If modeEvent.PreviousModeAutoSized Then
        label.Text = "changed to different " & label.Name & _
            DataGridView1.AutoSizeRowsMode.ToString()
    Else
        label.Text = label.Name & _
            DataGridView1.AutoSizeRowsMode.ToString()
    End If
End Sub

Comentarios

Para obtener más información acerca de cómo controlar eventos, vea controlar y provocar eventos.For more information about how to handle events, see Handling and Raising Events.

Se aplica a

Consulte también: