您的位置:首页 > 其它

【Vegas改编】Winform最小化,系统托盘出现图标,并气泡显示tip

2010-04-15 17:13 363 查看
环境:C#C/S

DEMO:





做法:

1,在Winform中拖进notifyIcon控件;

2,更改icon图标、Text内容;

3,在Click事件中添加:

privatevoidnotifyIcon1_Click(objectsender,EventArgse)

{

if(this.Visible==false)

{

this.Visible=true;


this.WindowState=FormWindowState.Normal;


this.notifyIcon1.Visible=false;

}

}


4,在Form窗口添加Resize事件:

privatevoidfrmServerWatch_Resize(objectsender,EventArgse)

{

if(this.WindowState==FormWindowState.Minimized)

{

this.Visible=false;

this.notifyIcon1.Visible=true;


notifyIcon1.BalloonTipTitle="PACSOSMonitor";

notifyIcon1.BalloonTipText="程序最小化,仍继续运行......"+"\r\n"+"单击托盘图标还原窗口.";

notifyIcon1.ShowBalloonTip(10);//消失时间

}

}


5,Try!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: