这个窗口是右下角提示小窗口,主要用于提示。 private void btnStartNotification_Click(object sender, EventArgs e)
这个窗口是右下角提示小窗口,主要用于提示。
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提示窗口内容请搜索编程网以前的文章或继续浏览下面的相关文章希望大家以后多多支持编程网!
--结束END--
本文标题: C# 重写Notification提示窗口的示例代码
本文链接: https://www.lsjlt.com/news/146247.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
一口价域名售卖能注册吗?域名是网站的标识,简短且易于记忆,为在线用户提供了访问我们网站的简单路径。一口价是在域名交易中一种常见的模式,而这种通常是针对已经被注册的域名转售给其他人的一种方式。
一口价域名买卖的过程通常包括以下几个步骤:
1.寻找:买家需要在域名售卖平台上找到心仪的一口价域名。平台通常会为每个可售的域名提供详细的描述,包括价格、年龄、流
443px" 443px) https://www.west.cn/docs/wp-content/uploads/2024/04/SEO图片294.jpg https://www.west.cn/docs/wp-content/uploads/2024/04/SEO图片294-768x413.jpg 域名售卖 域名一口价售卖 游戏音频 赋值/切片 框架优势 评估指南 项目规模
0