我正在尝试创建一个用于在简单的Windows窗体应用程序中显示系统托盘通知的示例。基本上,它看起来像这样:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void showToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Show();
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void Form1_Move(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.Hide();
notifyIcon1.ShowBalloonTip(1000, "Important Notice", "Something important has come up. Click to view more", ToolTipIcon.Info);
}
}
private void notifyIcon1_DoubleClick(object sender, EventArgs e)
{
this.Show();
}
}
执行并最小化后,我无法在通知窗口中找到右侧的图标。 你能帮我看看我错在哪里吗? 谢谢!
答案 0 :(得分:0)
你必须手动设置一个图标到你的NotifyIcon
,否则它将不会显示(通常我们认为它的默认图标就足够了,但不幸的是它不是!!)< / p>