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.
Unfortunately, activation email could not send to your email. Please try again.

How to chang the mouse cursor when CellMouseHoverEnter occur

Thread ID:

Created:

Updated:

Platform:

Replies:

12694 Apr 7,2004 09:47 PM Apr 8,2004 07:20 PM Windows Forms 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On April 7, 2004 09:47 PM

Using the GirdDataBoundGrid control, I want to chnag to mouse cursor to hand when the mouse point to a cell. My codes: private void rateBoundGrid_CellMouseHoverEnter(object sender, Syncfusion.Windows.Forms.Grid.GridCellMouseEventArgs e) { if (e.ColIndex == colIndexDep) { canChangCellStyle = true; this.rateBoundGrid.RefreshRange(GridRangeInfo.Cell(e.RowIndex, e.ColIndex)); } } private void rateBoundGrid_CellMouseHoverLeave(object sender, Syncfusion.Windows.Forms.Grid.GridCellMouseEventArgs e) { if (e.ColIndex == colIndexDep) { canChangCellStyle = false; this.rateBoundGrid.RefreshRange(GridRangeInfo.Cell(e.RowIndex, e.ColIndex)); } } private void rateBoundGrid_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e) { if (e.RowIndex > 0 && e.ColIndex > 0) { int row, col; Point mousePoint = this.rateBoundGrid.PointToClient(Control.MousePosition); this.rateBoundGrid.PointToRowCol(mousePoint, out row, out col, -1); if (row == e.RowIndex && col == e.ColIndex && canChangCellStyle) { canChangCellStyle = false; e.Style.TextColor = Color.Blue; e.Style.Font.Underline = true; this.rateBoundGrid.Cursor = Cursors.Hand; // It does not work this.Cursor = Cursors.Hand; // It does not work } } } I add the following code to my program. It does not work... private void rateBoundGrid_CellCursor(object sender, Syncfusion.Windows.Forms.Grid.GridCellCursorEventArgs e) { e.Cursor = Cursors.Hand; } Regards, Malin

Administrator [Syncfusion]
Replied On April 8, 2004 05:51 AM

If you want to control the cursor, here are two techniques you can use. The simplest way is to derive the grid, and override OnSetCursor. Here is a sample. You can add additional checks to narrow where you set the cursor. Another way is to implement IMouseController and fit directly into the grid''s mouse controller architecture. You can create a class that implements the IMouseController interface which will also allow you to control the cursor. This takes a little more code but does not require that you derive the grid to use it. Here is a sample that changes the cursor over the top half of each cell. This means that anywhere else, the grid allows the other controllers a chance to handle the mouse actions. Your mouse controller must implement the IMouseController interface. The main method you have to handle is the HitTest method. Returning a non-zero hit value at that point indicates to the grid that your mousecontroller wants control of things at this point. It will then the use your controller for all messages as long as the hittest returns nonzero. This means your controller will provide the cursor, it will handle the mousedown etc. In the sample, the only functionality implemented is to change the cursor and to handle a left click.

Administrator [Syncfusion]
Replied On April 8, 2004 07:20 PM

Thank you very much!

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

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.

;