C # Winform settings window opens special effects

Original: C # Winform settings window opens special effects

https://www.cnblogs.com/mq0036/p/6421946.html

using System.Runtime.InteropServices;  public class Win32  {   public const Int32 AW_HOR_POSITIVE = 0x00000001; // left to right, the window opens   public const Int32 AW_HOR_NEGATIVE = 0x00000002; // right to left open window   public const Int32 AW_VER_POSITIVE = 0x00000004; // top to bottom window open   public const Int32 AW_VER_NEGATIVE = 0x00000008; // open the window from the   public const Int32 AW_CENTER = 0x00000010; // if using AW_HIDE flag, so that the windows overlap inwardly; if not used AW_HIDE flag, so that the outward expansion of the window.   public const Int32 AW_HIDE = 0x00010000; // hide the window, the window is displayed by default.   public const Int32 AW_ACTIVATE =0x00020000; // active window. Do not use this flag after using AW_HIDE flag.   public const Int32 AW_SLIDE = 0x00040000; // use a sliding type. The default was rolling type of animation. When AW_CENTER flag, this flag is ignored.   public const Int32 AW_BLEND = 0x00080000; // use fade-out effect. Only when the hWnd for the top-level window can use this flag. [The DllImport ( " User32.dll ", the CharSet = CharSet.Auto)]   public static extern BOOL the AnimateWindow (IntPtr HWND, // handle to window     int dwTime, // DURATION of Animation     int the dwFlags // Animation type     );}  / ** // *Fade form * /  Private void the Form_Load ( Object SENDER, EventArgs E) {Win32.AnimateWindow ( this.Handle, 2000 , Win32.AW_BLEND);}  / * ** // fade form * /  Private void Form_FormClosing ( Object SENDER, E FormClosingEventArgs) {Win32.AnimateWindow ( this.Handle, 2000, Win32.AW_SLIDE | Win32.AW_HIDE | Win32.AW_BLEND);} 2 , form centrally Code / ** / /// <Summary> /// centered on the page / // </ Summary> public static void SetMid (Form1 form) { // Center the Form on the user's screen everytime it requires a Layout. form.SetBounds((Screen.GetBounds(form).Width / 2) - (form.Width / 2), (Screen.GetBounds(form).Height / 2) - (form.Height / 2), form.Width, form.Height, BoundsSpecified.Location); }

Guess you like

Origin www.cnblogs.com/lonelyxmas/p/11962470.html