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使用滑鼠左鍵ButtonState按一下儲存格, 並針對標頭啟用視覺化樣式, 則方法會將設為PushedThe 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.

適用於

另請參閱