开发者

NotifyIcon showing message from program

开发者 https://www.devze.com 2023-03-11 14:35 出处:网络
Just wondering if there is a way to display a message from the notifyicon when a certain event in the program is reached. Almost like a balloon popup. I cant seem to find anything online... This would

Just wondering if there is a way to display a message from the notifyicon when a certain event in the program is reached. Almost like a balloon popup. I cant seem to find anything online... This would be used to alert the user t开发者_如何学Co a certain event in the program.

Thanks in advance!


If you use notify icon:

        this.WindowState = FormWindowState.Minimized;
        notifyIcon1.Icon = new Icon(SystemIcons.Application, 40, 40);
        notifyIcon1.Visible = true;

Much like you can use the BallonTip member of the it:

        notifyIcon1.BalloonTipText = "The quick brown fox. Jump!";
        notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
        notifyIcon1.BalloonTipTitle ="Alert!";
        notifyIcon1.ShowBalloonTip(500);

You can use everytime certain event or condition is meet, you can always have the ShowBalloonTip method call.


I'm not sure if you use WPF or not, but here is some great code I found a while back that allows you to do a whole lot with notifications. I believe you can use it in Winforms as well.

http://www.hardcodet.net/projects/wpf-notifyicon

If you want to pay for something (or you already have it), part of the Telerik suite includes a DesktopAlert feature:

http://www.telerik.com/products/winforms/desktopalert.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号