DataGridView.OnRowStateChanged(Int32, DataGridViewRowStateChangedEventArgs) 方法

定义

引发 RowStateChanged 事件。Raises the RowStateChanged event.

protected:
 virtual void OnRowStateChanged(int rowIndex, System::Windows::Forms::DataGridViewRowStateChangedEventArgs ^ e);
protected virtual void OnRowStateChanged (int rowIndex, System.Windows.Forms.DataGridViewRowStateChangedEventArgs e);
abstract member OnRowStateChanged : int * System.Windows.Forms.DataGridViewRowStateChangedEventArgs -> unit
override this.OnRowStateChanged : int * System.Windows.Forms.DataGridViewRowStateChangedEventArgs -> unit
Protected Overridable Sub OnRowStateChanged (rowIndex As Integer, e As DataGridViewRowStateChangedEventArgs)

参数

rowIndex
Int32

正在更改状态的行的索引。The index of the row that is changing state.

异常

从只读更改为读/写的行,启用当前单元格以进入编辑模式,但当前单元格的 EditType 属性不指示派生自 Control 并实现 IDataGridViewEditingControl 的类。The row changed from read-only to read/write, enabling the current cell to enter edit mode, but the EditType property of the current cell does not indicate a class that derives from Control and implements IDataGridViewEditingControl.

注解

引发事件时,将通过委托调用事件处理程序。Raising an event invokes the event handler through a delegate. 有关详细信息,请参阅处理和引发事件For more information, see Handling and Raising Events.

OnRowStateChanged 方法还允许派生类对事件进行处理而不必附加委托。The OnRowStateChanged method also allows derived classes to handle the event without attaching a delegate. 这是在派生类中处理事件的首选技术。This is the preferred technique for handling the event in a derived class.

继承者说明

在派生类中重写 OnRowStateChanged(Int32, DataGridViewRowStateChangedEventArgs) 时,一定要调用基类的 OnRowStateChanged(Int32, DataGridViewRowStateChangedEventArgs) 方法,以便已注册的委托对事件进行接收。When overriding OnRowStateChanged(Int32, DataGridViewRowStateChangedEventArgs) in a derived class, be sure to call the base class's OnRowStateChanged(Int32, DataGridViewRowStateChangedEventArgs) method so that registered delegates receive the event.

适用于

另请参阅