C# winform 右下角弹出窗口结果
右下角弹窗界面:
以下是代码:
1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.Text; 7 using System.Windows.Forms; 8 9 using System.Runtime.InteropServices; 10 11 namespace 右下角弹窗 12 { 13 public partial class Form1 : Form 14 { 15 16 [DllImport("user32")] 17 private static extern bool AnimateWindow(IntPtr hwnd,int dwTime,int dwFlags); 18 19 //声明常量 20 private const int AW_HOR_POSITIVE = 0x0001; //自左向右显示窗口 21 private const int AW_HOR_NEGATIVE = 0x0002; //自右向左显示窗口 22 private const int AW_VER_POSITIVE = 0x0004; //自顶向下显示窗口 23 private const int AW_VER_NEGATIVE = 0x0008; //自下向上显示窗口 24 //以上标记可以在迁移转变动画和滑动动画中应用,应用AW_CENTER标记时忽视该标记 25 26 private const int AW_CENTER = 0x0010; //若应用了AW_HIDE标记,则使窗口向内重叠,不然向外扩大 27 private const int AW_HIDE = 0x10000; //隐蔽窗口 28 private const int AW_ACTIVE = 0x20000; //**窗口,在应用了AW_HIDE标记后不要应用这个标记 29 private const int AW_SLIDE = 0x40000; //应用滑动类型结果,默认迁移转变动画类型,当应用AW_CENTER标记时该标记补忽视 30 private const int AW_BLEND = 0x80000; //应用应用淡入淡出效果 31 32 33 public Form1() 34 { 35 InitializeComponent(); 36 } 37 38 private void Form1_Load(object sender, EventArgs e) 39 { 40 int x = Screen.PrimaryScreen.WorkingArea.Right - this.Width; 41 int y = Screen.PrimaryScreen.WorkingArea.Bottom - this.Height; 42 this.Location = new Point(x,y); //设置窗体在屏幕右下角显示 43 44 //AnimateWindow(this.Handle,1000,AW_SLIDE|AW_ACTIVE|AW_VER_NEGATIVE); 45 46 AnimateWindow(this.Handle, 250, AW_BLEND | AW_ACTIVE | AW_VER_NEGATIVE); 47 } 48 49 private void Form1_FormClosing(object sender, FormClosingEventArgs e) 50 { 51 AnimateWindow(this.Handle,250,AW_BLEND|AW_HIDE); 52 } 53 } 54 }