DataGridViewHeaderCell.OnMouseDown(DataGridViewCellMouseEventArgs) DataGridViewHeaderCell.OnMouseDown(DataGridViewCellMouseEventArgs) DataGridViewHeaderCell.OnMouseDown(DataGridViewCellMouseEventArgs) DataGridViewHeaderCell.OnMouseDown(DataGridViewCellMouseEventArgs) Method

定义

当指针在单元格上并按住鼠标按钮时调用。Called when the mouse button is held down while the pointer is on a cell.

protected:
 override void OnMouseDown(System::Windows::Forms::DataGridViewCellMouseEventArgs ^ e);
protected override void OnMouseDown (System.Windows.Forms.DataGridViewCellMouseEventArgs e);
override this.OnMouseDown : System.Windows.Forms.DataGridViewCellMouseEventArgs -> unit
Protected Overrides Sub OnMouseDown (e As DataGridViewCellMouseEventArgs)

参数

注解

OnMouseDown方法设置ButtonStatePushed如果用鼠标左键单击该单元格和标头启用了可视样式。The OnMouseDown method sets the ButtonState to Pushed if the cell is clicked with the left mouse button and visual styles are enabled for headers. 对于标头的视觉样式的详细信息,请参阅DataGridView.EnableHeadersVisualStyles属性。For more information about visual styles for headers, see the DataGridView.EnableHeadersVisualStyles property.

此方法是类似于DataGridView.OnCellMouseDown方法。This method is similar to the DataGridView.OnCellMouseDown method. 在同一环境中调用DataGridView.CellMouseDown引发事件,但不会实际引发该事件。It is called in the same circumstances in which a DataGridView.CellMouseDown event is raised, but it does not actually raise the event.

继承者说明

重写时OnMouseDown(DataGridViewCellMouseEventArgs)在派生类中,请务必调用基类的OnMouseDown(DataGridViewCellMouseEventArgs)方法。When overriding OnMouseDown(DataGridViewCellMouseEventArgs) in a derived class, be sure to call the base class's OnMouseDown(DataGridViewCellMouseEventArgs) method.

适用于

另请参阅