Similar to QQ pop-up window, automatically disappear

Source: Internet
Author: User

usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Runtime.InteropServices;usingSystem.Text;usingSystem.Threading;usingSystem.Threading.Tasks;usingSystem.Windows.Forms;namespaceformcpm{ Public Partial classForm1:form {Const intCountdown = -;//Countdown        intCurrcountdown = Countdown;//Countdown        BOOLIscount =true;        Thread thread;  PublicForm1 () {InitializeComponent (); Thread=NewThread (() =            {                 while(true)                {                    if(iscount) {if(Currcountdown <=0)                        {                             This. Invoke (NewAction (() =                            {                                 This.                            Close ();                            }));  Break; }                        Else{Thread.Sleep ( -); Currcountdown--;  This. Invoke (NewAction (() =                            {                                 This. Opacity = This. Opacity- This. Opacity/Countdown;                        })); }                    }                    Else{Thread.Sleep (Ten);                    }                }            }); Thread. IsBackground=true; } [DllImport ("User32")]        Private Static extern BOOLAnimateWindow (INTPTR hwnd,intDwtime,intdwFlags); //The following constants are available, which are declared in accordance with the results of an inappropriate animation        Private Const intAw_hor_positive =0x0001;//Displays the window from left to right, which can be applied in the migration Transitions animation and slide animations. Ignore this tag when applying aw_center tags        Private Const intAw_hor_negative =0x0002;//Displays the window from right to left, which can be applied in the migration Transitions animation and slide animations. Ignore this tag when applying aw_center tags        Private Const intAw_ver_positive =0x0004;//the top-down display window, which can be applied in the migration Transitions animation and slide animations. Ignore this tag when applying aw_center tags        Private Const intAw_ver_negative =0x0008;//Displays the window from the bottom up, which can be applied in the migration Transitions animation and slide animations. The tag is ignored when the aw_center tag is applied        Private Const intAw_center =0x0010;//if the aw_hide tag is applied, the window overlaps inside; otherwise it expands outwards.        Private Const intAw_hide =0x10000;//Hidden window        Private Const intAw_active =0x20000;//activates the window and does not apply this tag after the aw_hide tag has been applied        Private Const intAw_slide =0x40000;//applying the slide type animation result, the default is the migration Transition animation type, which is ignored when the aw_center tag is applied        Private Const intAw_blend =0x80000;//Apply Fade Results        Private voidForm1_Load (Objectsender, EventArgs e) {            intx = Screen.PrimaryScreen.WorkingArea.Right- This.            Width; inty = Screen.PrimaryScreen.WorkingArea.Bottom- This.            Height;  This. Location =NewPoint (x, y);//the setup form appears in the lower-right corner of the screenAnimateWindow ( This. Handle, +, Aw_slide | aw_active |aw_ver_negative); Thread.        Start (); }Private voidForm1_mouseenter (Objectsender, EventArgs e) {Iscount=false; Currcountdown=Countdown;
This. Opacity = 1d;
} Private voidForm1_mouseleave (Objectsender, EventArgs e) {Iscount=true; } }}

Similar to QQ pop-up window, automatically disappear

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.