Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

MaxHeight, MaxLeft, MaxTop, MaxWidth, MinHeight, MinWidth

Specifies how large or small a form window can be sized and where it can be placed.

Usage

nHowTall = objForm.MaxHeight
nHowWide = objForm.MaxWidth
nHowShort = objForm.MinHeight
nHowThin = objForm.MinWidth
objForm.MaxHeight = nHowTall
objForm.MaxWidth = nHowWide
objForm.MinHeight = nHowShort
objForm.MinWidth = nHowThin

The MaxHeight and MaxWidth properties specify the maximum dimensions to which a form can be stretched. This stretching can occur via operator action by resizing the window with mouse or keyboard, or programmatically (using ZOOM WINDOW, or by changing WindowState, Height or Width). MinHeight and MinWidth specify the minimum dimensions the form can assume. The “minimized” or “iconized” state is not affected by the Min-dimensions; only resizing using the mouse or keyboard, or by changing the form’s Height and Width, is affected.

Usage

nColumn = objForm.MaxLeft
nRow = objForm.MaxTop
objForm.MaxLeft = nColumn
objForm.MaxTop = nRow

MaxLeft and MaxTop, on the other hand, specify the position a form should have when maximized. When the form is maximized, it is not movable, nor can it be resized using the mouse or keyboard. While all the other “Max” properties are the maximum value within a range of values that a particular property can have, the MaxTop and MaxLeft are the only values their properties can have when the form is maximized. We think this is an unfortunate overloading of the prefix, and bound to lead to confusion.

All of these properties respect, and are scaled to, the appropriate ScaleMode.

Example

oForm = CREATEOBJECT("TestForm")
oForm.Show()

DEFINE CLASS TestForm AS Form
  #INCLUDE FOXPRO.H
  ScaleMode = SCALEMODE_PIXELS
  Top = 10
  Left = 10
  Height = 100
  Width = 100
  MaxHeight = 200
  MaxWidth = 200
  MaxTop = 15
  MaxLeft = 15
  MinHeight = 50
  MinWidth = 50
ENDDEFINE

See Also

Height, Left, ScaleMode, Top, Width, WindowState, Zoom Window