# RegionUse APIs to implement form fade-in and fade-out effects
// Form fade-in and fade-out effects
Public ConstInt32 aw_hor_positive = 0x00000001;// Open the window from left to right
Public ConstInt32 aw_hor_negative = 0x00000002;// Open the window from right to left
Public ConstInt32 aw_ver_positive = 0x00000004;// Open the window from top to bottom
Public ConstInt32 aw_ver_negative = 0x00000008;// Open the window from bottom to top
Public ConstInt32 aw_center = 0x00000010;
Public ConstInt32 aw_hide = 0x00010000;// Add this constant if you want to use this function when uninstalling the form.
Public ConstInt32 aw_activate = 0x00020000;// After the form is opened through this function, the focus will be lost by default, unless this constant is added
Public ConstInt32 aw_slide = 0x00040000;
Public ConstInt32 aw_blend = 0x00080000;// Fade-in and fade-out effect
[System. runtime. interopservices. dllimport ("User32.dll", Charset = system. runtime. interopservices. charset. Auto)]
Public Static Extern BoolAnimatewindow (
Intptr hwnd,// Handle to window
IntDwtime,// Duration of Animation
IntDwflags// Animation type
);
# Endregion
// Call:
Animatewindow (form2.handle, 5000, aw_blend );// Fade-in form
// Application. exitthread ();
Animatewindow (form2.handle, 5000, aw_slide | aw_hide | aw_blend );// Fade out form