WPF NotifyIcon气球未显示

时间:2014-09-22 10:22:27

标签: c# wpf notifyicon balloon-tip

好的伙伴们,对C#来说还是新手,但我已经很好了。

我已将应用程序最小化到系统托盘,我正在使用WPF NotifyIcon执行此操作。我正在尝试使用内置的气泡笔功能。

虽然我没有错误,但似乎没有错误。

我的代码如下:

    private void OnTaskBarMenuItemExitClick(object sender, RoutedEventArgs e)
    {
        m_isExplicitClose = true;//Set this to unclock the Minimize on close 

        this.Close();

        string title = "WPF NotifyIcon";
        string text = "This is a standard balloon";

        TaskBar.ShowBalloonTip(title, text, Properties.Resources.Server);
    }

当我关闭应用程序时,它会隐藏到系统托盘(并且确实),但是也应该弹出BalloonTip(而不是)。

任何想法;我很难过? :(

2 个答案:

答案 0 :(得分:2)

图标格式存在一些限制,并且已经与海报进行了TeamViewer会话,我们得出的结论是它是导致问题的图标。

private void OnTaskBarMenuItemExitClick(object sender, RoutedEventArgs e)
{
    m_isExplicitClose = true;//Set this to unclock the Minimize on close 

    this.Close();

    string title = "WPF NotifyIcon";
    string text = "This is a standard balloon";

    TaskBar.ShowBalloonTip(title, text, BalloonIcon.Error);
}

正确工作并解决了气球未出现的问题。

答案 1 :(得分:0)

private void OnTaskBarMenuItemExitClick(object sender, RoutedEventArgs e)
{
    m_isExplicitClose = true;//Set this to unclock the Minimize on close 

    this.Hide();

    string title = "WPF NotifyIcon";
    string text = "This is a standard balloon";

    TaskBar.ShowBalloonTip(title, text, Properties.Resources.Server);
}

点击此链接:http://www.techotopia.com/index.php/Hiding_and_Showing_Forms_in_C_Sharp

相关问题