欢迎莅临 SUN WU GANG 的园子!!!

世上无难事,只畏有心人。有心之人,即立志之坚午也,志坚则不畏事之不成。

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

-------------------控件NotifyIcon-----------
//客户端调用
private void btnShowError_Click(object sender, EventArgs e)
{
string error = "程序出错";
BubbleHelper.Instance.SetBubbleTime(1000, error);
}
//提取的气泡提示帮助类
public class BubbleHelper
{
private static BubbleHelper instance;

public static BubbleHelper Instance
{
get
{
if (instance == null)
{
instance = new BubbleHelper();
}
return BubbleHelper.instance;
}
}

NotifyIcon notify = null;
public void SetBubbleTime(int millisecond, string error)
{
if (notify == null)
{
notify = new NotifyIcon();
}

this.notify.Visible = true;

string path = Application.StartupPath + "//error.ico";
this.notify.Icon = new Icon(path);
this.notify.ShowBalloonTip(millisecond, "异常提示", error, ToolTipIcon.Error);
}
}

 

posted on 2016-07-12 11:42  sunwugang  阅读(692)  评论(0编辑  收藏  举报