DataGridViewColumnStateChangedEventArgs.StateChanged Propriété

Définition

Obtient le nouvel état de colonne.

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

Valeur de propriété

Une des valeurs de l'objet DataGridViewElementStates.

Exemples

L’exemple de code suivant illustre l’utilisation de ce membre. Dans l’exemple, un gestionnaire d’événements signale l’occurrence de l’événement DataGridView.ColumnStateChanged . Ce rapport vous aide à savoir quand l’événement se produit et peut vous aider à déboguer. Pour signaler plusieurs événements ou événements qui se produisent fréquemment, envisagez de MessageBox.ShowConsole.WriteLine remplacer par ou d’ajouter le message à un multiligne TextBox.

Pour exécuter l’exemple de code, collez-le dans un projet qui contient un instance de type DataGridView nommé DataGridView1. Vérifiez ensuite que le gestionnaire d’événements est associé à l’événement DataGridView.ColumnStateChanged .

private void DataGridView1_ColumnStateChanged(Object sender, DataGridViewColumnStateChangedEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "Column", e.Column );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "StateChanged", e.StateChanged );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "ColumnStateChanged Event" );
}
Private Sub DataGridView1_ColumnStateChanged(sender as Object, e as DataGridViewColumnStateChangedEventArgs) _ 
     Handles DataGridView1.ColumnStateChanged

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

End Sub

S’applique à

Voir aussi