DataGrid::OnMouseDown Method (MouseEventArgs^)
.NET Framework (current version)
Raises the MouseDown event.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Parameters
- e
-
Type:
System.Windows.Forms::MouseEventArgs^
A MouseEventArgs that contains data about the OnMouseDown event.
Raising an event invokes the event handler through a delegate. For an overview, see NIB: Raising an Event.
Notes to Inheritors:
When overriding OnMouseDown in a derived class, be sure to call the base class's OnMouseDown method.
The following code example demonstrates the use of this member.
public ref class MyDataGrid: public DataGrid { protected: // Override the OnMouseDown event to select the whole row // when the user clicks anywhere on a row. virtual void OnMouseDown( MouseEventArgs^ e ) override { // Get the HitTestInfo to return the row and pass // that value to the IsSelected property of the DataGrid. DataGrid::HitTestInfo ^ hit = this->HitTest( e->X, e->Y ); if ( hit->Row < 0 ) return; if ( this->IsSelected( hit->Row ) ) UnSelect( hit->Row ); else Select(hit->Row); } };
.NET Framework
Available since 1.1
Available since 1.1
Show: