Properties
Methods
Events
- The Me keyword may be used to represent
the form:
-
- The Load statement places a Form in
memory, but does not display it (> method: Show)
-
NB: The form is automatically loaded if a property, method or control is
accessed (so, the Load statement is not necessary)
NB: When a form loads, any code in the Form_Load() event procedure is
executed.
- The Unload statement removes a form from memory (>
method: Hide)
-
| Form - Properties: |
| design: |
BorderStyle, ControlBox, MaxButton, MDIChild, MinButton |
| design/run: |
Font, Icon, Left, StartupPosition,
Top, Width, WindowState |
|
- BorderStyle
0 - None
= vbBSNone |
 |
1 - Fixed Single
= vbFixedSingle |
 |
2 - Sizable (Default)
= vbSizable |
 |
3 - Fixed Dialog
= vbFixedDialog |
 |
4 - Fixed Tool Window
= vbFixedToolWindow |
 |
5 - Sizable Tool Window
= vbSizableToolWindow |
 |
- ControlBox
-
- MaxButton
| True |
 |
| False |
 |
- MDIChild
- MinButton
| True |
 |
| False |
 |
-
- Font
- sets base font used by the form's Print method - and for controls
added to the form.
> object: Font
-
- Icon
- Left
- StartupPosition [vb5]
- Form position when the form loads
| 0 - Manual |
Form position set by properties Top and Left |
| 1 - CenterOwner |
Form centered
- on Windows desktop (non-MDI)
- in MDI parent window (MDI child form) |
| 2 - CenterScreen |
Form centered on Windows desktop |
| 3 - Windows Default |
Form placed by Windows |
- > Event: Resize
- Top
- Width
- WindowState
Form - Methods:
Hide, Line, Move, Print,
PopUpMenu, Pset, Show
- Hide
- removes a form from the screen but not from memory - the properties may still be
accessed.
-
- > statement: Unload
- > method: Show
- > event: Deactivate
- Line
| [Form.]Line [[Step](x1, y1)] - [Step](x2, y2) [,[color][,B[F]]] |
' make line, color 0 (black)
Line (200, 100)-(1200, 500), 0
' make rectangle, color red
Line (200, 100)-(1200, 500), QBColor(12), B |
 |
-
- PopUpMenu
- Display the PopUp Menu 'popFormat'
| frmMain.PopUpMenu popFormat |
- > event: MouseUp
-
- Print
- > property: AutoRedraw, CurrentX, CurrentY, Font
> method: Refresh
- Pset
| [Form.]PSet [Step](x, y)[,color] |
-
For i = 200 To 2000
PSet (i, 200), QBColor(14)
Next |
 |
-
- Show
- (loads and) displays and activates a form
| frmForm1.Show [m][, owner] |
| m |
| 0 |
Modeless: Other forms may be activated while this form is open. |
| 1 = vbModal |
Modal: No other form or code may be activated or executed until this form is closed. |
|
|
-
-
- > statement: Load
- > method: Hide
- > event: Activate, Load
Form - Events:
MouseDown, MouseUp
start sequence: Initialize, Load, Resize, Paint, Activate
stop sequence: QueryUnload, Deactivate, Unload, Terminate
- Initialize
- when the form object is created
-
- Load
- when the form is loaded into memory
- > statement: Load
- > method: Show
-
- Activate, Deactivate
- Activate is triggered when a form is activated (gets focus). The show method will activate the form.
-
- Deactivate is triggered when an active form loses focus. The Hide method will deactivate the form.
-
- These events respond only to shifts in focus between the forms af VB - not between VB
and other Windows programs.
- > statement: Load
> property: ActiveControl, Screen.ActiveForm
> method: Hide, SetFocus, Show
> event: GotFocus/LostFocus, Initialize/Terminate, QueryUnLoad
-
- Resize
- > Ex: 1 - Keep form centered after size is changed
-
- Unload
- when form is removed from memory.
Unloading the last form ends the program.
> Statement: Unload
> method: Hide
-
- MouseDown, MouseUp
| Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) |
| Button |
:
|
vbLeftButton
vbRightButton |
| Shift |
:
|
|
| X, Y |
:
|
Location on screen of mouse cursor |
|
- Display PopUp Menu 'popFormat' when RightClick on Form:
Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
frmMain.PopUpMenu popFormat
End If
End Sub
|
- > method: PopUpMenu