DataGridViewAutoSizeModeEventHandler DataGridViewAutoSizeModeEventHandler DataGridViewAutoSizeModeEventHandler DataGridViewAutoSizeModeEventHandler Delegate

Definizione

Rappresenta il metodo che gestirà l'evento AutoSizeRowsModeChanged o RowHeadersWidthSizeModeChanged di un oggetto DataGridView.Represents the method that will handle the AutoSizeRowsModeChanged or RowHeadersWidthSizeModeChanged events of a DataGridView.

public delegate void DataGridViewAutoSizeModeEventHandler(System::Object ^ sender, DataGridViewAutoSizeModeEventArgs ^ e);
public delegate void DataGridViewAutoSizeModeEventHandler(object sender, DataGridViewAutoSizeModeEventArgs e);
type DataGridViewAutoSizeModeEventHandler = delegate of obj * DataGridViewAutoSizeModeEventArgs -> unit
Public Delegate Sub DataGridViewAutoSizeModeEventHandler(sender As Object, e As DataGridViewAutoSizeModeEventArgs)

Parametri

sender
Object Object Object Object

Origine dell'evento.The source of the event.

Ereditarietà
DataGridViewAutoSizeModeEventHandlerDataGridViewAutoSizeModeEventHandlerDataGridViewAutoSizeModeEventHandlerDataGridViewAutoSizeModeEventHandler

Esempi

Nel codice seguente viene illustrato come gestire l' AutoSizeRowsModeChanged evento.The following code demonstrates how to handle the AutoSizeRowsModeChanged event.

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

Commenti

L' AutoSizeRowsModeChanged evento viene generato quando cambia il valore AutoSizeRowsMode della proprietà del DataGridView controllo.The AutoSizeRowsModeChanged event is raised when the value of the AutoSizeRowsMode property of the DataGridView control changes. L' RowHeadersWidthSizeModeChanged evento viene generato quando cambia il valore RowHeadersWidthSizeMode della proprietà.The RowHeadersWidthSizeModeChanged event is raised when the value of the RowHeadersWidthSizeMode property changes.

Quando si crea un delegato DataGridViewAutoSizeModeEventHandler, si identifica il metodo che gestirà l'evento.When you create a DataGridViewAutoSizeModeEventHandler delegate, you identify the method that will handle the event. Per associare l'evento al gestore eventi in uso, aggiungere all'evento un'istanza del delegato.To associate the event with your event handler, add an instance of the delegate to the event. Il gestore eventi viene chiamato ogni volta che si verifica l'evento, a meno che non venga rimosso il delegato.The event handler is called whenever the event occurs, unless you remove the delegate. Per ulteriori informazioni sui delegati del gestore eventi, vedere gestione e generazione di eventi.For more information about event-handler delegates, information about event-handler delegates, see Handling and Raising Events.

Metodi di estensione

GetMethodInfo(Delegate) GetMethodInfo(Delegate) GetMethodInfo(Delegate) GetMethodInfo(Delegate)

Ottiene un oggetto che rappresenta il metodo rappresentato dal delegato specificato.Gets an object that represents the method represented by the specified delegate.

Si applica a

Vedi anche