We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Close Icon
Unfortunately, activation email could not send to your email. Please try again.
Close Icon
close icon
Vote for your favorite ebook
Succinctly Readers Awards 2020
Syncfusion Feedback

How do I change the mouse cursor in GridControl, GridDataBoundGrid and GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl |
Published Date: April 21, 2015 |
Last Revised Date: April 21, 2015
Tags: cursor


When you move the mouse cursor over the Grid, by default the arrow cursor is displayed. You can change the mouse cursor by using the following three methods.


You can implement this in three ways,

  1. Using CellCursor event.
  2. Using OnSetCursor.
  3. Using IMouseController interface.

Using CellCursor event

The easiest way to change the cursor for the grid cells is to handle the Gridcontrol's CellCursor event and assign the cursor object to the Cursor property and set e.Cancel to true. This event method is called when the Grid queries, the cursor that is to be displayed for a cell and before the cell renderer returns its cursor. But, also other MouseControllers can take control in cases like ResizingColumns, ResizingRows, and Drag/Drop displaying mouse cursors according to the controllers.

Refer to the following code example for GridControl, GridDataBoundGrid and GridGroupingControl respectively.










Using OnSetCursor()

In this method, derive the Grid and override the OnSetCursor. You can also add additional checks to narrow down as to where you want to set the cursor.

Refer to the following code example for GridControl OnSetCursor method and similarly for GridDataBoundGrid and GridGroupingControl.



Using IMouseController

In this method, implement the IMouseController interface that allows you to control the cursor, and fit it directly into the grid's mouse controller architecture. This requires more code but, it is not required to derive the Grid. The main method that you handle in this is the HitTest that returns a non-zero hit-test value to indicate the Grid at the point where your mouse controller wants the control.

Refer to the following code example for GridControl IMouseController method and similarly for GridDataBoundGrid and GridGroupingControl.



The following screenshot illustrates the output.

Figure 1: Cursor change in GridControl

C:\Users\ApoorvahR\Desktop\Note.pngNote: In the above screenshot, you can see the mouse cursor changed while hovering on GridControl and a similar output arrives for both GridDataBoundGrid and GridGroupingControl.




2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon