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

How to: Scroll a View Horizontally Using the Mouse Wheel

The following example handles the BaseView.MouseWheel event to perform horizontal scrolling, instead of vertical scrolling, when the mouse wheel is rotated. The View is horizontally scrolled by changing the GridView.LeftCoord property value.

To prevent the default vertical scrolling action, the event handler sets the Handled parameter to true.

using DevExpress.Utils;
using DevExpress.XtraGrid.Views.Grid;

private void gridView1_MouseWheel(object sender, MouseEventArgs e) {
    GridView view = (sender as GridView);
    view.LeftCoord += e.Delta;
    (e as DXMouseEventArgs).Handled = true;
}