Share via


Defining Form Behavior

When you are designing a form in the Form Designer, the form is live: except for setting the Visible property to false (.F.), visual and behavioral changes you make are immediately reflected in the form. If you set the WindowState property to 1 – Minimized or 2 – Maximized, the form in the Form Designer immediately reflects this setting. If you set the Movable property to false (.F.), a user will not be able to move the form at run time and you won't be able to move the form at design time either. You might want to design the functionality of your form and add all the appropriate controls before you set some of the properties that determine form behavior.

The following form properties are commonly set at design time to define the appearance and behavior of the form.

Property Description Default
AlwaysOnTop Controls whether a form is always on top of other open windows. False (.F.)
AutoCenter Controls whether the form is automatically centered in the main Visual FoxPro window or on the desktop when the form is initialized. False (.F.)
BackColor Determines the color of the form window. 255,255,255
BorderStyle Controls whether the form has no border, a single-line border, a double-wide border, or a system border. If the BorderStyle is 3 - System, the user will be able to resize the form. 3
Caption Determines the text displayed in the title bar of the form. Form1
Closable Controls whether the user can close the form by double-clicking the close box. True (.T.)
DataSession Controls whether the tables in the form are opened in work areas that are globally accessible or private to the form. 1
MaxButton Controls whether or not the form has a maximize button. True (.T.)
MinButton Controls whether or not the form has a minimize button. True (.T.)
Movable Controls whether or not the form can be moved to a new location on the screen. True (.T.)
ScaleMode Controls whether the unit of measurement in object size and position properties is foxels or pixels. Determined by settings in the Options dialog box.
Scrollbars Controls the type of scroll bars a form has. 0 - None
TitleBar Controls whether a title bar appears at the top of the form. 1 - On
ShowWindow Controls whether the window is a child (in screen), floating, or top-level window. 0 - In Screen
WindowState Controls whether the form is minimized (in Windows only), maximized, or normal. 0 - Normal
WindowType Controls whether the form is modeless (the default) or modal. If the form is modal, the user must close the form before accessing any other elements of your application's user interface. 0 – Modeless

You can use the LockScreen property to make run-time adjustment of control layout properties appear cleaner.

Assigning Icons to Forms

In Visual FoxPro for Windows, you can assign an icon to the form; the icon is displayed when the window is minimized in Windows NT® and in the title bar in Windows 2000 or Windows Me. To assign an icon to a form, set the form's Icon property to the name of an .ico file.

To assign an icon to a form

  1. Open the form.
  2. Open the Properties window.
  3. Set the Icon property to the .ico file that you want to display.

See Also

Manipulating Objects | Editing Event and Method Code | Creating Forms | Form Designer | Visible | Saving Forms