0

好的,伙计们,对 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(并且不会)。

有任何想法吗; 我被难住了?:(

4

2 回答 2

3

图标格式存在一些限制,并且在与海报进行了 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);
}

工作正常并解决了气球没有出现的问题。

于 2014-09-22T19:39:08.683 回答
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

于 2014-09-22T10:30:57.583 回答