DataGridViewCellStateChangedEventArgs.StateChanged 属性

定义

获取已更改的单元格状态。

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

属性值

DataGridViewElementStates 值之一,指示单元格的状态已更改。

示例

下面的代码示例演示了此类型的用法。

private void dataGridView1_CellStateChanged(object sender,
    DataGridViewCellStateChangedEventArgs e)
{
    DataGridViewElementStates state = e.StateChanged;
    string msg = String.Format("Row {0}, Column {1}, {2}",
        e.Cell.RowIndex, e.Cell.ColumnIndex, e.StateChanged);
    MessageBox.Show(msg, "Cell State Changed");
}
Private Sub dataGridView1_CellStateChanged(ByVal sender As Object, _
    ByVal e As DataGridViewCellStateChangedEventArgs) _
    Handles dataGridView1.CellStateChanged

    Dim state As DataGridViewElementStates = e.StateChanged
    Dim msg As String = String.Format( _
        "Row {0}, Column {1}, {2}", _
        e.Cell.RowIndex, e.Cell.ColumnIndex, e.StateChanged)
    MessageBox.Show(msg, "Cell State Changed")

End Sub

适用于

另请参阅