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.
Syncfusion Feedback

How do I convert a point to a grid row and column?

Thread ID:

Created:

Updated:

Platform:

Replies:

7944 Oct 15,2003 11:53 AM UTC Oct 15,2003 02:31 PM UTC Windows Forms 1
loading
Tags: GridControl
Don
Asked On October 15, 2003 11:53 AM UTC

I'm sure I've seen code to do this before, but I can't seem to find it. How does one convert an X,Y coordinate into a row and column when the user clicks on the grid (say, for example, in the gri'd MouseUp event)?

Administrator [Syncfusion]
Replied On October 15, 2003 02:31 PM UTC

You use the grid.PointToRowCol method. The point you pass in must be in the grid coordinates. Point pt = grid.PointToClient(Control.MousePosition); int rowIndex, colIndex; grid.PointToRowCol(pt, out rowIndex, out colIndex); If you are in one of the grid's mouse events, the e.X and e.Y are in the grid's coordiante system, so you can just use Point pt = new Point(e.X, e.Y); to get the point and not have to call PointToClient.

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.

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

;