GridHitTest Method
Returns, as output parameters, the components of a grid control corresponding to specified horizontal (X) and vertical (Y) coordinates.
Grid.GridHitTest(nXCoord_In, nYCoord_In
[, nWhere_Out [, nRelRow_Out [, nRelCol_Out [, nView_Out]]]])
Parameters
nXCoord_In
Specifies the horizontal (X) position in pixels within the form containing the grid.nYCoord_In
Specifies the vertical (Y) position in pixels within the form containing the grid.nWhere_Out
An output parameter that contains a value corresponding to the grid component at the position specified with nXCoord_In and nYCoord_In. The following table lists the values for @nWhere\_Out and the corresponding grid component.@nWhere_Out
Grid component
0
A grid component that cannot be determined.
1
Column header.
2
Between column headers.
3
Cell.
4
Reserved.
5
SplitBar.
6
Record deletion marker.
7
Reserved
8
Reserved.
9
Reserved.
10
Reserved.
11
Box in upper left corner.
12
Record marker.
13
Column header sizing area.
14
Row sizing area.
15
Reserved.
16
Horizontal scrollbar.
17
Vertical scrollbar.
nRelRow_Out
An output parameter containing the relative grid row at the specified point.nRelCol_Out
An output parameter containing the relative grid column at the specified point.nView_Out
An output parameter containing a value corresponding to the grid pane containing the specified point. If the grid is split into two panes, this parameter contains 0 if the specified point is in the left pane, and contains 1 if the specified point is in the right pane. If the grid isn't split into separate panes, this parameter contains 1.
Remarks
Applies To: Grid Control
The GridHitTest( ) method returns true (.T.) if the specified point is within the grid; otherwise false (.F.) is returned.
The GridHitTest( ) method can be used during mouse events or OLE drop target events to determine where the mouse pointer is positioned over the grid. The nRelRow_Out and nRelCol_Out parameters can be passed to the ActivateCell( ) method to activate a specific cell in the grid.