ViewPortHeight, ViewPortWidth

These properties tell you the dimensions of the visible portion of a form. They're really only relevant when the form has scrollbars.

Usage

nVisibleHeight = frmForm.ViewPortHeight
nVisibleWidth = frmForm.ViewPortWidth
When a form has scrollbars, some portion of it is hidden. (We almost said "may be hidden," but the way scrollbars work, they only appear if a portion of the form is actually hidden.) These two properties let you know the size of the part of the form the user can see.

Although the "inside area" of the form accounts for a title bar, if there is one, it doesn't consider scrollbars. So, if you resize a form vertically and make a scrollbar appear, ViewPortWidth doesn't change, even though less of the actual form is now visible to the user. Oddly, Height and Width, which we'd expect to include every little bit of real estate occupied by the form, do consider both a title bar and scrollbars. So, the Height of a form can be less than its ViewPortHeight. Weird.


Example

IF This.ViewPortWidth > nSomeMagicValue
   * There's enough room to do something special
   This.oleGreatPicture.Visible = .T.
ENDIF

See Also

Form, Height, ViewPortLeft, ViewPortTop, Width


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .