-------------------控件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);
}
}