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.

mouse events - hover

Thread ID:

Created:

Updated:

Platform:

Replies:

981 Sep 10,2002 06:44 AM Nov 19,2003 01:00 PM Windows Forms 4
loading
Tags: GridControl
Andre King
Asked On September 10, 2002 06:44 AM

Hi, I would like to catch the mouse hover event and determine the cell the mouse is on. The intent is to display a user control over the cell. Can you suggest the best method for this? The mouse hover event only gives a system event (no x,y). I started looking at the MouseDispatchController but am getting lost. thanks, a

Clay Burch [Syncfusion]
Replied On September 10, 2002 07:54 AM

Here is code that will retrieve the row and col numbers of the hover cell as well as the cell rectangle. private void gridControl1_MouseHover(object sender, System.EventArgs e) { Point pt = this.gridControl1.PointToClient(Cursor.Position); int row, col; this.gridControl1.ViewLayout.PointToClientRowCol(pt, out row, out col, true); Rectangle cellRect = this.gridControl1.RangeInfoToRectangle(GridRangeInfo.Cell(row, col)); Console.WriteLine(cellRect.ToString()); }

Andre King
Replied On September 12, 2002 04:41 PM

Just what I needed, thanks.

Administrator [Syncfusion]
Replied On November 19, 2003 11:45 AM

I have found that this does not work correctly if the grid has horizontal scrolling and you have scrolled the grid. In this case the first visible column returns 1, when it is actually column 6 or 7 or whatever. Do you know of a way that I can get the true column that the mouse is over? Thanks for your help. > Here is code that will retrieve the row and col numbers of the hover cell as well as the cell rectangle. > > > private void gridControl1_MouseHover(object sender, System.EventArgs e) > { > Point pt = this.gridControl1.PointToClient(Cursor.Position); > > int row, col; > this.gridControl1.ViewLayout.PointToClientRowCol(pt, out row, out col, true); > > Rectangle cellRect = this.gridControl1.RangeInfoToRectangle(GridRangeInfo.Cell(row, col)); > > Console.WriteLine(cellRect.ToString()); > } >

Administrator [Syncfusion]
Replied On November 19, 2003 01:00 PM

Use this grid method instead of the one on the ViewLayout. this.gridControl1.PointToRowCol(pt, out row, out col, -1);

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.

;