G
G
Governor2016-10-30 18:09:27
Programming
Governor, 2016-10-30 18:09:27

C#. How to call a balloon from the tray?

How to call an alert window from the tray in C#?
And does the program have to be minimized to tray?
Here is an example from punto:
2f9aeb663de3497097441fafd39dc5ed.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Nemiro, 2016-10-30
@Mr-Governor

Place a NotifyIcon component on the form if you are using a Windows Forms project .
To display a notification, use the NotifyIcon.ShowBalloonTip method :

// необходимо обязательно указать иконку
// иначе уведомление не будет отображаться
// можно использовать иконку формы
notifyIcon1.Icon = this.Icon;

// показываем уведомление
notifyIcon1.ShowBalloonTip(
  10000, 
  "Новый ответ", 
  "Поступил новый ответ на ваш вопрос на Toster.ru",
  ToolTipIcon.Info
);

// или с текстом по умолчанию (см. BalloonTipTitle, BalloonTipText)
// notifyIcon1.ShowBalloonTip(10000);

The program window can be in any state.
In projects other than Windows Forms , you can include the System.Windows.Forms assembly , but it's better to figure it out, maybe there is a more correct solution. For example, for console applications, this solution is quite suitable.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question