WinForm实现右下角弹窗

15 篇文章 0 订阅
  1. using System.Runtime.InteropServices;

  2. public partial class Form2 : Form

  3. {

  4. public Form2()

  5. {

  6. InitializeComponent();

  7. }

  8. [DllImport("user32")]

  9. private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags);

  10. private static int AW_HIDE = 0x00010000;//该变量表示动画隐藏窗体

  11. private static int AW_SLIDE = 0x00040000;//该变量表示出现滑行效果的窗体

  12. private static int AW_VER_NEGATIVE = 0x00000008;//该变量表示从下向上开屏

  13. private static int AW_VER_POSITIVE = 0x00000004;//该变量表示从上向下开屏

  14. private const int AW_ACTIVE = 0x20000;//激活窗口

  15. private const int AW_BLEND = 0x80000;//应用淡入淡出结果

  16. private void Form2_Load(object sender, EventArgs e)

  17. {

  18. int x = Screen.PrimaryScreen.WorkingArea.Right - this.Width;

  19. int y = Screen.PrimaryScreen.WorkingArea.Bottom - this.Height;

  20. this.Location = new Point(x, y);//设置窗体在屏幕右下角显示

  21. AnimateWindow(this.Handle, 1000, AW_SLIDE | AW_ACTIVE | AW_VER_NEGATIVE);

  22. }

  23. //弹窗关闭

  24. private void simpleButton2_Click(object sender, EventArgs e)

  25. {

  26. AnimateWindow(this.Handle, 1000, AW_BLEND | AW_HIDE);

  27. }

  28. }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lijingguang

有钱捧个钱场,没钱捧个人场

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值