Winform form animation effect

Source: Internet
Author: User

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 );
}

}
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.