环境: C# C/S
DEMO:
做法:
1,在Winform中拖进notifyIcon控件;
2,更改icon图标、Text内容;
3,在Click事件中添加:
private void notifyIcon1_Click(object sender, EventArgs e)
{
if (this.Visible == false)
{
this.Visible = true;
this.WindowState = FormWindowState.Normal;
this.notifyIcon1.Visible = false;
}
}
4,在Form窗口添加Resize事件:
private void frmServerWatch_Resize(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.Visible = false;
this.notifyIcon1.Visible = true;
notifyIcon1.BalloonTipTitle = "PACS OS Monitor";
notifyIcon1.BalloonTipText = "程序最小化,仍继续运行......" + "\r\n" + "单击托盘图标还原窗口.";
notifyIcon1.ShowBalloonTip(10);//消失时间
}
}
5,Try!
相关文章
暂无评论...