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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Inconsistent result from grid.PointToRowCol and grid.Viewlayout.PointToClientRowCol

Thread ID:

Created:

Updated:

Platform:

Replies:

47648 Aug 9,2006 02:42 PM UTC Aug 14,2006 09:36 AM UTC WinForms 3
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On August 9, 2006 02:42 PM UTC

I have a case in which these 2 functions return inconsistent results.
Consider the following snippet:

void grid_MouseClick (object sender, MouseEventArgs e) {
int r1, r2, c1, c2;
grid.PointToRowCol (new Point (e.X, e.Y), out r1, out c1);
grid.ViewLayout.PointToClientRowCol (new Point (e.X, e.Y), out r2, out c2, [b]true[\b], GridCellSizeKind.VisibleSize);

Debug.WriteLine (string.Format ("PointToRowCol ({0}, {1})\nClientPointToRowCol ({2}, {3}", r1, c1, grid.GetRow (r2), grid.GetCol (c2)));
}

when clicking in the grid the two row/col sets are always in agreement.
Except when clicking the first column and these 2 conditions are met:
- grid.properties.rowheaders = false
- fixBackHidden parameter = true

In this case the PointToRowCol call will return the correct col nr (1), whereas the PointToClientRowCol call will return 0 as col number and will not fix this up to 1 in the GetCol call.

The other columns do return the correct index.

Administrator [Syncfusion]
Replied On August 10, 2006 07:14 AM UTC

Hi Palmer,

Please try the code snippet given below for the PointToClientRowCol method in the MouseDown event handler which, will return the column index as intended when the rowheaders are hidden.

//
int row, col;
this.gridControl1.ViewLayout.PointToClientRowCol(this.gridControl1.PointToClient(Control.MousePosition), out row, out col, false, GridCellSizeKind.ActualSize);
Console.WriteLine("PointToClientRowCol - RowIndex: {0} ColIndex: {1}", row, col);
//

The PointToRowCol method calculates the row and column index for a cell that is displayed at a specific point.
The PointToClientRowCol method Returns client row and column indexes under a window point. This method is now obsolete.

Refer to the attached sample for more information.
http://www.syncfusion.com/Support/user/uploads/Forum_47648_4d40dc9a.zip

Thanks for using Syncfusion Products.
Regards,
Rajagopal

Administrator [Syncfusion]
Replied On August 10, 2006 07:50 AM UTC

Hi Rajagopal,

That seems to work.

I thought only the versions of PointToClientRowCol without the GridSizeKind parameter were obsolete.
Are you saying that the other version is obsolete as well?
Does this apply to the other PointToClient... funtions also?

Administrator [Syncfusion]
Replied On August 14, 2006 09:36 AM UTC

Hi Palmer,

Yes. This method is obsolete in the latest version. Please refer to the documentation for more details.

Thanks,
Rajagopal

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

;