ClientWidth Property

Returns the width of the control's client area, in twips.

Syntax

val& = [form!]VSFlexGrid.ClientWidth

Remarks

The ClientHeight and ClientWidth properties are useful for setting column widths and row heights proportionally to the size of the control.

These properties return values that are slightly smaller than the control's Width and Height properties, because they discount the space taken up by the scrollbars and the control's borders.

For example, the code below scales the columns widths proportionally whenever the grid is resized:

    Private Sub Form_Load()

        fg.Cols = 3

        fg.ExtendLastCol = True

        fg.ScrollBars = flexScrollBarVertical

    End Sub

   

    Private Sub Form_Resize()

        fg.Move 0, 0, ScaleWidth, ScaleHeight

        fg.ColWidth(0) = fg.ClientWidth * 0.2

        fg.ColWidth(1) = fg.ClientWidth * 0.4

        fg.ColWidth(2) = fg.ClientWidth * 0.4

    End Sub

Note that the code sets the ExtendLastCol property to True to eliminate any round-off errors.

Data Type

Long

See Also

VSFlexGrid Control