RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomDrawGrid.MouseToCell Method

Returns the column and row of the cell at the position with screen coordinates (X,Y).

Pascal
procedure MouseToCell(X: Integer; Y: Integer; var ACol: Longint; var ARow: Longint);
C++
__fastcall MouseToCell(int X, int Y, Longint ACol, Longint ARow);

Call MouseToCell to convert from grid-relative screen coordinates to row and column indexes. The X and Y parameters are the screen coordinates of the point to be converted. MouseToCell returns the ACol parameter as the number of the column over the point (X,Y), and the ARow parameter as the number of the row.  

Usually the MouseToCell method is used in a mouse event handler, which supplies the mouse coordinates as the X and Y parameters of the method call. 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!