RowPosproperty
Returns the distance, intwips, between the upper-left corner of the MSHFlexGrid and the upper-left corner of a specified row.
Syntax
PROPERTY RowPos (BYVAL Index AS LONG) AS LONG
Parameters
| Name | Description | |
|---|---|---|
Index | The zero-based index of the row. |
Description
Returns the distance, in twips, between the upper-left corner of the grid and the upper-left corner of a specified row.
Remarks
The value is relative to the upper-left corner of the grid control itself.
If a row is currently scrolled out of view or has a RowHeight of 0, RowPos still returns its calculated logical position within the grid structure.
While RowPos returns a coordinate, the related RowPosition property is used to move a row to a new index in the grid.
Developers often use RowPos (combined with ColPos) to accurately position another control, such as a TextBox or ComboBox, directly over a specific cell to simulate in-cell editing.
In advanced UI scenarios, it helps determine exactly which row is located at a specific mouse Y-coordinate during MouseDown or MouseMove events.
RowPos for fixed header rows (e.g., RowPos(0)) will usually return 0 (or the thickness of the grid's border) because they are locked at the top of the viewport.
Example
' Get the top coordinate of the 5th row in twips Dim rowTop As Long rowTop = grid.RowPos(4)
Reference
- Documented in Windows/Windows GUI/MSHFlexGrid Class.md
- Topic: Microsoft Hierarchical Grid