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