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.
AD
Administrator
Syncfusion Team
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
AD
Administrator
Syncfusion Team
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?
AD
Administrator
Syncfusion Team
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