1 Public Partial classForm2:form2 {3System.Diagnostics.Stopwatch STH =NewSystem.Diagnostics.Stopwatch ();4 5[DllImport ("User32")]6 Private Static extern BOOLAnimateWindow (INTPTR hwnd,intDwtime,intdwFlags);7 8 //here are the constants available, declaring what you need depending on the animation effect9 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 flagTen 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 One 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 A 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 the 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 - + PublicForm2 () - { + InitializeComponent (); A } at - Private voidForm2_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 screen inAnimateWindow ( This. Handle, +, Aw_slide | aw_active |aw_ver_negative); - sth. Start (); toTimer1. Enabled =true; + } - the Private voidForm2_formclosing (Objectsender, FormClosingEventArgs e) * { $AnimateWindow ( This. Handle, +, Aw_blend |aw_hide);Panax Notoginseng } - the Private voidButton4_Click (Objectsender, EventArgs e) + { A This. Close (); the This. Dispose (); + } - $ Private voidTimer1_Tick (Objectsender, EventArgs e) $ { - sth. Stop (); -TimeSpan ts =sth. Elapsed; the if(TS. TotalSeconds >=3) - {WuyiButton4_Click (NULL,NULL); the } - Else Wu { - sth. Start (); About } $ } -}
Popup form mode:
New Form2 (). Show ();
C # Pop-up window in lower right corner