Use APIs to implement form fade-in and fade-out effects

Source: Internet
Author: User
 

 
# 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

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.