|
|
|
|
|
Home
|
Created By Wesley
Griffin |
|
|
|
|
|
 |
Animate the way in
which a form is shown or hidden. |
|
|
|
|
|
|
Home
> Source Code > Forms
and Controls > Animate Window |
|
|
|
|
|
A
very good way to make your applications more professional is to
animate your forms as they become shown or hidden. The windows api
provides a function for exactly this behaviour. Copy the following
code into the code window of a form: |
|
|
|
|
|
Const
AW_HOR_POSITIVE = &H1 'Animates
the window from left to right. This flag can be used with roll or
slide animation. |
Const
AW_HOR_NEGATIVE = &H2 'Animates
the window from right to left. This flag can be used with roll or
slide animation. |
Const
AW_VER_POSITIVE = &H4 'Animates
the window from top to bottom. This flag can be used with roll or
slide animation. |
Const
AW_VER_NEGATIVE = &H8 'Animates
the window from bottom to top. This flag can be used with roll or
slide animation. |
Const
AW_CENTER = &H10 'Makes the
window appear to collapse inward if AW_HIDE is used or expand
outward if the AW_HIDE is not used. |
Const
AW_HIDE = &H10000 'Hides the
window. By default, the window is shown. |
Const
AW_ACTIVATE = &H20000 'Activates
the window. |
Const
AW_SLIDE = &H40000 'Uses slide
animation. By default, roll animation is used. |
Const
AW_BLEND = &H80000 'Uses a fade
effect. This flag can be used only if hwnd is a top-level window. |
Private
Declare Function AnimateWindow Lib
"user32"
(ByVal
hwnd As Long,
ByVal
dwTime As Long,
ByVal
dwFlags As Long)
As Boolean |
|
|
|
|
|
|
To
call use the function use the following syntax either in the forms load or
unload procedures: |
|
|
|
|
|
AnimateWindow
Me.Hwnd, 200, <FLAGS> |
|
|
|
|
|
|
Time
The time, the second parameter of the
AnimateWindow function is measured in milleseconds. 200 is the
typical value for an animation.
Flags
The flags are the constants listed in the
declaration section for example, AW_ACTIVATE. Combine the flags to
experiment different animation effects. When combining flags
remember OR is used instead of AND. For example to activate a form and
roll in from left to right you would use the following syntax |
|
|
|
|
|
AnimateWindow
Me.Hwnd, 200, AW_ACTIVATE or
AW_SLIDE or
AW_HOR_POSITIVE |
|
|
|
|
|
|
Top.
|
|
|
|
|
|
 |
Warning: |
All
material from this site must be used at own risk. VB First Aid will
take no responsibility for any loss of data or any other errors. The
material on this site was written for Visual Basic Version 6, therefore
compatibility with other versions may cause errors. |
|
|
|