FlexGrid for WinForms | ComponentOne
C1.Win.C1FlexGrid Namespace / C1FlexGridBase Class / BeforeMouseDown Event

In This Topic
    BeforeMouseDown Event (C1FlexGridBase)
    In This Topic
    Fires before the System.Windows.Forms.Control.MouseDown event is handled by the grid.
    Public Event BeforeMouseDown As BeforeMouseDownEventHandler
    public event BeforeMouseDownEventHandler BeforeMouseDown
    Event Data

    The event handler receives an argument of type BeforeMouseDownEventArgs containing data related to this event. The following BeforeMouseDownEventArgs properties provide information specific to this event.

    Gets which mouse button was pressed.  
    Gets or sets a value indicating whether the event should be canceled.  
    Gets the number of times the mouse button was pressed and released.  
    Gets a signed count of the number of detents the mouse wheel has rotated. A detent is one notch of the mouse wheel.  
    Gets the x-coordinate of a mouse click.  
    Gets the y-coordinate of a mouse click.  
    This event fires before the grid processes the System.Windows.Forms.Control.MouseDown event, and gives the program a chance to customize the behavior of the control and optionally cancel the default handling of the mouse.
    The code below handles the BeforeMouseDown event to detect clicks on row headers and provide OLE drag and drop functionality.
    void _flex_BeforeMouseDown(object sender, C1.Win.C1FlexGrid.BeforeMouseDownEventArgs e)
    	// start dragging when the user clicks the row headers
    	HitTestInfo hti = _flex.HitTest(e.X, e.Y);
    	if (hti.Type == HitTestTypeEnum.RowHeader)
    		e.Cancel = true;  // cancel default handling
    		HandleRowDragDrop(hti.Row); // handle row drag/drop
    See Also