Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

BaseView.MouseDown Event

Occurs when the mouse pointer is over a View and a mouse button is pressed.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v24.2.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

#Declaration

[DXCategory("Mouse")]
public event MouseEventHandler MouseDown

#Event Data

The MouseDown event's data class is MouseEventArgs. The following properties provide information specific to this event:

Property Description
Button Gets which mouse button was pressed.
Clicks Gets the number of times the mouse button was pressed and released.
Delta Gets a signed count of the number of detents the mouse wheel has rotated, multiplied by the WHEEL_DELTA constant. A detent is one notch of the mouse wheel.
Location Gets the location of the mouse during the generating mouse event.
X Gets the x-coordinate of the mouse during the generating mouse event.
Y Gets the y-coordinate of the mouse during the generating mouse event.

#Remarks

If you handle the MouseDown event for a detail View, the event sender identifies the clone that has actually raised the event.

A common practice of handling the MouseDown event is to perform specific actions in response to pressing a specific View element. Refer to the Hit Information help topic for information on how to identify the element located under the mouse pointer.

using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;

private void gridView1_MouseDown(object sender, MouseEventArgs e) {
    GridHitInfo info = (sender as GridView).CalcHitInfo(e.Location);
    int rowHandle = info.InRow ? info.RowHandle : GridControl.InvalidRowHandle;
    MessageBox.Show(rowHandle.ToString());
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the MouseDown event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also