Form animation effect, using the API provided by Windows:
Using System;
Using System. Collections. Generic;
Using System. componentmodel;
Using System. Data;
Using System. drawing;
Using System. text;
Using System. Windows. forms;
Using System. runtime. interopservices;
NamespaceWindowsapplication1
{
Public Partial ClassForm1: Form
{
[Dllimportattribute ("User32.dll")]
// Intptr hwnd: The handle object of the target window, which is generally this. Handle
// Int dwtime: animation duration. The longer the value, the longer the animation effect.
// Int dwflags: animation effect type option
Private Static Extern Bool Animatewindow (intptr hwnd, Int Dwtime, Int Dwflags );
/// <Summary>
/// Aw_hor_positive: display window from left to right
/// </Summary>
Public Const Int32 aw_hor_positive = Zero X 00000001 ;
/// <Summary>
/// Aw_hor_negative: display window from right to left
/// </Summary>
Public Const Int32 aw_hor_negative = Zero X 00000002 ;
/// <Summary>
/// Aw_ver_positve: top-down display window
/// </Summary>
Public Const Int32 aw_ver_positive = Zero X 00000004 ;
/// <Summary>
/// Aw_ver_negative: display window from bottom to top
/// </Summary>
Public Const Int32 aw_ver_negative = Zero X 00000008 ;
/// <Summary>
/// Aw_center: when used with the aw_hide effect, the effect overlaps the number of windows, and the window is extended separately.
/// </Summary>
Public Const Int32 aw_center = Zero X 00000010 ;
/// <Summary>
/// Aw_hide: Hide the window
/// </Summary>
Public Const Int32 aw_hide = Zero X 00010000 ;
/// <Summary>
/// Aw_active: The activation window. This effect cannot be used when the aw_hide effect is used.
/// </Summary>
Public Const Int32 aw_activate = Zero X 00020000 ;
/// <Summary>
/// Aw_slide: This type is used by default. This type is ignored when the aw_center effect is used.
/// </Summary>
Public Const Int32 aw_slide = Zero X 00040000 ;
/// <Summary>
/// Aw_blend: fade-in effect
/// </Summary>
Public Const Int32 aw_blend = Zero X 00080000 ;
PublicForm1 ()
{
Initializecomponent ();
Animatewindow (This. Handle,1000, Aw_slide+Aw_center );
}
Private VoidForm1_formclosed (ObjectSender, formclosedeventargs E)
{
Animatewindow (This. Handle,500, Aw_slide+Aw_ver_positive+Aw_hide );
}
}
}