I am writing code in which if updates are available then I want to show a pop up message with balloon using C#. This is similar to "Java Updates available".
With the help of the NotifyIcon
class and the BalloonTipIcon
property, I can show the icon in the notification area but not this type of message. Any suggestions will be helpful.
You can use NotifyIcon
for this.
this.WindowState = FormWindowState.Minimized;
notifyIcon.BalloonTipIcon = ToolTipIcon.Info;
notifyIcon.BalloonTipTitle = "Notify Icon Test Application";
notifyIcon.BalloonTipText = "You have just minimized the application." +
Environment.NewLine +
"Right-click on the icon for more options.";
notifyIcon.ShowBalloonTip(5000);
This will generate popup like one as below:
You can find more details on this link .
Got the correct output as desired with the below code.
notifyIcon1.Visible = true;
notifyIcon1.Icon = SystemIcons.Exclamation;
notifyIcon1.BalloonTipTitle = "Balloon Tip Title";
notifyIcon1.BalloonTipText = "Balloon Tip Text.";
notifyIcon1.BalloonTipIcon = ToolTipIcon.Error;
notifyIcon1.ShowBalloonTip(1000);
Thanks @Bhushan for your suggestion....
There is a very simple single-line command you can write for this, instead of doing all that bulky thing others suggest:
notifyIcon1.ShowBalloonTip(1000, "Text", "Title", ToolTipIcon.Warning);
Remember that you need to have first initialized the control in your application so that this code works. You are free to adjust the control's name and the command's parameters according to your needs.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.