C#怎么重写Notification提示窗口
发表于:2025-11-13 作者:千家信息网编辑
千家信息网最后更新 2025年11月13日,这篇文章主要介绍了C#怎么重写Notification提示窗口的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇C#怎么重写Notification提示窗口文章都会有所收获,
千家信息网最后更新 2025年11月13日C#怎么重写Notification提示窗口
这篇文章主要介绍了C#怎么重写Notification提示窗口的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇C#怎么重写Notification提示窗口文章都会有所收获,下面我们一起来看看吧。
这个窗口是右下角提示小窗口,主要用于提示。

private void btnStartNotification_Click(object sender, EventArgs e){ Bz.Controls.BzNotification notification = new Bz.Controls.BzNotification(); notification.ShowAlert("启动成功", Bz.Controls.BzNotification.enumType.Success);}public partial class BzNotification : Form{ public static int Count = 0; System.Windows.Forms.Timer timer = new Timer(); private int x, y; public event Action OnNotificationClosed; private bool isClosed = false; public BzNotification() { InitializeComponent(); timer.Enabled = true; timer.Tick += Timer_Tick; } private void Timer_Tick(object sender, EventArgs e) { switch (action) { case enmAction.wait: timer.Interval = 5000; action = enmAction.close; break; case enmAction.start: timer.Interval = 1; this.Opacity += 0.1; if (this.x < this.Location.X) { this.Left--; } else { if (this.Opacity == 1.0) { action = enmAction.wait; } } break; case enmAction.close: timer.Interval = 1; this.Opacity -= 0.1; this.Left -= 3; if (base.Opacity == 0.0 && isClosed==false) { isClosed = true; base.Close(); } break; default: break; } } public enum enmAction { wait, start, close } public enum enumType { Success, Warning, Error, Info } private enmAction action; public void ShowAlert(string msg, enumType type) { this.Opacity = 0.0; this.StartPosition = FormStartPosition.Manual; this.x = Screen.PrimaryScreen.WorkingArea.Width - this.Width + 15; this.y = Screen.PrimaryScreen.WorkingArea.Height - this.Height - this.Height*Count-5*Count; this.Location = new Point(this.x, this.y); this.x = Screen.PrimaryScreen.WorkingArea.Width - base.Width - 5; switch (type) { case enumType.Success: picLogo.Image = Properties.Resources.success_icon; this.BackColor = Color.SeaGreen; break; case enumType.Error: picLogo.Image = Properties.Resources.error_info; this.BackColor = Color.DarkRed; break; case enumType.Info: picLogo.Image = Properties.Resources.info_icon; this.BackColor = Color.RoyalBlue; break; case enumType.Warning: picLogo.Image = Properties.Resources.alert_icon; this.BackColor = Color.DarkOrange; break; } lblMessage.Text = msg; this.Show(); this.action = enmAction.start; Count++; timer.Interval = 1; } private void picClose_Click(object sender, EventArgs e) { timer.Interval = 1; action = enmAction.close; if (Count > 0) Count--; } protected override void OnClosed(EventArgs e) { base.OnClosed(e); if (OnNotificationClosed != null) { OnNotificationClosed(); } if (Count > 0) Count--; } }关于"C#怎么重写Notification提示窗口"这篇文章的内容就介绍到这里,感谢各位的阅读!相信大家对"C#怎么重写Notification提示窗口"知识都有一定的了解,大家如果还想学习更多知识,欢迎关注行业资讯频道。
提示
C#
知识
内容
篇文章
成功
价值
操作简单
文章
易懂
更多
看吧
行业
资讯
资讯频道
频道
学习
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
软件开发配台式电脑
软件开发真实业务设计面试题
政治安全网络安全工作情况
2021年网络安全什么时候结束
水浒日记软件开发
森途数据库
软件开发专项奖励申请报告
检察网络安全培训会
微信云开发数据库是什么数据库
幻塔玩什么服务器好
鹤壁标签打印软件开发
软件开发 用ddr4
考勤系统怎么找原数据库
疾风软件开发有限公司
老师应该如何做好网络安全工作
自学软件开发公司
柯南服务器时间怎么看
广电网络技术员
吃鸡地图总是卡在服务器
软件不在安全数据库中
网络技术做技术
2021年网络安全什么时候结束
魔兽世界亚戈雷斯服务器
数据库系统技术 填空题
数据库视图的更名和删除
如何提高汽车嵌入式软件开发质量
电脑开机显示prc服务器不可能
西安鸿鹄网络技术有限公司
我的世界指令服务器手机版
dell服务器硬盘两个指示灯