语言

DataGridView.OnCellMouseDown(DataGridViewCellMouseEventArgs) 方法

定义

引发 CellMouseDown 事件。

protected:
 virtual void OnCellMouseDown(System::Windows::Forms::DataGridViewCellMouseEventArgs ^ e);
protected virtual void OnCellMouseDown(System.Windows.Forms.DataGridViewCellMouseEventArgs e);
abstract member OnCellMouseDown : System.Windows.Forms.DataGridViewCellMouseEventArgs -> unit
override this.OnCellMouseDown : System.Windows.Forms.DataGridViewCellMouseEventArgs -> unit
Protected Overridable Sub OnCellMouseDown (e As DataGridViewCellMouseEventArgs)

参数

例外

属性的值ColumnIndexe大于控件中的列数减一。

-或-

该属性RowIndex的值e大于控件中的行数减一。

此操作将提交单元格值或进入编辑模式,但数据源中的错误会阻止操作,并且没有事件的处理程序 DataError 或处理程序已将 ThrowException 属性 true设置为 。

注解

引发事件会通过委托调用事件处理程序。 有关详细信息,请参阅 处理和引发事件。

该方法 OnCellMouseDown 还允许派生类在不附加委托的情况下处理事件。 这是处理派生类中的事件的首选技术。

继承者说明

在派生类中重写 OnCellMouseDown(DataGridViewCellMouseEventArgs) 时,请务必调用基类的方法,以便已注册的 OnCellMouseDown(DataGridViewCellMouseEventArgs) 委托接收事件。

适用于

另请参阅