Online Method Summary
First type: AnimateWindow window animation
Advantages: Good fade-in effect
Disadvantage: The window does not start to draw the above control, the effect is not good.
/// <summary> ///form Animation function Note: to refer to System.Runtime.InteropServices; /// </summary> /// <param name= "hwnd" >Specifies the handle of the window that produces the animation</param> /// <param name= "Dwtime" >Specify how long the animation lasts</param> /// <param name= "DwFlags" >Specifies the type of animation, which can be a combination of one or more flags. </param> /// <returns></returns>[DllImport ("User32")] Private Static extern BOOLAnimateWindow (INTPTR hwnd,intDwtime,intdwFlags); //here are the constants available, declaring what you need depending on the animation effect Private Const intAw_hor_positive =0x0001;//Displays the window from left to right, which can be used in scrolling animations and slide animations. Ignore this flag when using the Aw_center flag Private Const intAw_hor_negative =0x0002;//Displays the window from right to left, which can be used in scrolling animations and slide animations. Ignore this flag when using the Aw_center flag Private Const intAw_ver_positive =0x0004;//the top-down display window, which can be used in scrolling animations and slide animations. Ignore this flag when using the Aw_center flag Private Const intAw_ver_negative =0x0008;//Displays the window from the bottom up, which can be used in scrolling animations and slide animations. This flag is ignored when using the Aw_center flag Private Const intAw_center =0x0010;//If the Aw_hide flag is used, the window will overlap inward; otherwise scale out Private Const intAw_hide =0x10000;//Hide Window Private Const intAw_active =0x20000;//Activate the window, do not use this flag after using the AW_HIDE flag Private Const intAw_slide =0x40000;//using the slide type animation effect, the default is the scrolling animation type, which is ignored when using the Aw_center flag Private Const intAw_blend =0x80000;//using the Fade effect Private voidFrmmsg_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); } Private voidFrmmsg_formclosing (Objectsender, FormClosingEventArgs e) {AnimateWindow ( This. Handle, +, Aw_blend |aw_hide); }Reference:C # WinForm form pops up from the lower-right corner of the window effectC # Simple Implementation fade popup message appears in the bottom right corner (Demo)Winform the bottom right corner of the screen pops up a prompt windowThe second type: Draw your own animation
This approach ensures that the controls on the form are always displayed with a continuous refresh form:
Private voidButton1_Click (Objectsender, EventArgs e) {Form2 Form2=NewForm2 (); //form fly-In processPoint P =NewPoint (Screen.PrimaryScreen.WorkingArea.Width-Form2. Width, Screen.PrimaryScreen.WorkingArea.Height); Form2. Pointtoscreen (P); Form2. Location=p; Form2. Show (); for(inti =0; I <= Form2. Height; i++) {Form2. Location=NewPoint (p.x, P.Y-i); Form2. Refresh ();//Refresh the formThread.Sleep (5); } }
Method case: WinForm C # screen pop-up message box in the lower right corner, disappear automatically
C # pop-up tip in the lower right corner