DataGridViewColumnStateChangedEventArgs.StateChanged Proprietà

Definizione

Ottiene il nuovo stato della colonna.

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

Valore della proprietà

Uno dei valori di DataGridViewElementStates.

Esempio

Nell'esempio di codice seguente viene illustrato l'uso di questo membro. Nell'esempio un gestore eventi segnala l'occorrenza dell'evento DataGridView.ColumnStateChanged . Questo report consente di apprendere quando si verifica l'evento e può essere utile per il debug. Per segnalare più eventi o eventi che si verificano di frequente, provare a sostituire MessageBox.Show o Console.WriteLine accodare il messaggio a un oggetto multilinea TextBox.

Per eseguire il codice di esempio, incollarlo in un progetto contenente un'istanza di tipo DataGridView denominata DataGridView1. Assicurarsi quindi che il gestore eventi sia associato all'evento 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

Si applica a

Vedi anche