Balloon tip text must have a non-empty value exception
I got "Balloon tip text must have a non-empty value" exception when the OnStateChange(). This method called when my application is minimized.
void OnStateChanged(object sender, EventArgs args)
{
try
{
if (WindowState == WindowState.Minimized)
{
Hide();
if (TippuTrayNotify != null)
{
TippuTrayNotify.Visible = true;
TippuTrayNotify.ShowBalloonTip(2000);
}
}
else
m_storedWindowState = WindowState;
}catch(Exception ex){
SystemLog.WriteLine("(Error) OnStateChange : "+ex.Message+" ;");
}
}
I initial TippuTrayNotify within MainWindow constructor
public MainWindow()
{
InitializeComponent();
TippuTrayNotify = new System.Windows.Forms.NotifyIcon();
TippuTrayNotify.Icon = new System.Drawing.Icon("Icons/i开发者_如何学编程con_64.ico");
TippuTrayNotify.BalloonTipTitle = "OlivInClass";
TippuTrayNotify.Text = "OlivInClass";
TippuTrayNotify.DoubleClick += new EventHandler(TippuTrayNotify_DoubleClick);
}
Any solution please
Text
appears to be what shows when you mouse over the icon, not the balloon tip text. That's set via the BalloonTipText
property.
notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
notifyIcon1.BalloonTipText = "your text";
notifyIcon1.BalloonTipTitle = "Welcome Message";
notifyIcon1.ShowBalloonTip(1000);
精彩评论