Top Property
This property returns the position of a column's top edge relative to the top of the control in terms of the coordinate system of the control's container.
column.Top
Read-only at run time. Not available at design time.
Property applies to Column object.
If the column contains a header, the Top property returns the position of the header's top edge; if the column does not contain a header, the Top property returns the position of the top edge of the column's cell within the first displayed row.
If the control's MultipleLines property is 0 - Disabled (the default value), a single record cannot span multiple lines in the control, and the Top property returns the same value for all columns.
If the control's MultipleLines property is either 1 - Variable or 2 - Fixed, a single record may span multiple lines in the control. For columns on the first line, the Top property returns the height of the control's caption bar and split headings, if present. For columns on succeeding lines, the Top property returns this value plus an appropriate multiple of the column header height.
Columns on the same line will return the same Top property value, while columns occupying lower lines in a row will return larger Top property values since they are farther away from the top of the control.
For example, the following code places a text box on top of the header for the first column:
Text1.Top = TDBList1.Top + TDBList1.Columns(0).Top
Use the Top property in conjunction with Left, Width, and RowTop to determine the exact location and size of a column heading.
Note: To overlay the text box exactly on a column header, you may need to account for an extra pixel in the width and height, depending upon the settings of the DividerStyle and RowDividerStyle properties. In Visual Basic, if the ScaleMode (Form) property of the parent form is set to pixels, then you can simply add 1. If the ScaleMode (Form) is set to twips, then you can add the TwipsPerPixelX (Screen) and TwipsPerPixelY (Screen) properties of the Screen (Visual Basic) object.
See Also