NotifyIcon没有出现在系统托盘中 [英] NotifyIcon not appearing in systray

查看:131
本文介绍了NotifyIcon没有出现在系统托盘中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个应在Windows启动时启动的应用程序.我已经将路径添加到注册表中的exe文件中以实现此目的,并且它按预期工作.当应用程序启动时,主窗体会在其构造器中最小化,并在系统托盘中显示NotifyIcon.问题是有时NotifyIcon不会出现在系统托盘中,但是当我查看任务管理器中的进程列表时,我可以看到该应用程序正在运行.

到目前为止,这是应用程序中唯一的代码

I am making an application that is supposed to start when windows starts. I have added the path to the exe file in the registry to achive this, and it works as intended. When the application starts the main form is minimized in it''s contructor, and a NotifyIcon is shown in the systray. The problem is that sometimes the NotifyIcon does not appear in the systray, but when i look at the processlist in the task manager i can see that the application is running.

So far this is the only code in the application

public Form1()
{
    InitializeComponent();

    notifyIcon1.Text = "Tray icon test";
    WindowState = FormWindowState.Minimized;
}

private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
    notifyIcon1.Visible = false;
    this.Close();
}



我认为这可能与系统托盘有关,有时在应用程序启动时未准备就绪.



I think it could have something to do with the systray sometimes not being "ready" when the application starts.

Any suggestions to what could cause this behavior?

推荐答案

这不是确切的问题,但可能会有所帮助...

http://social.msdn.microsoft.com/论坛/en-US/winforms/thread/737c2dcc-7894-482c-ad39-2566d26ef7c4 [
This is not exact problem but may help...

http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/737c2dcc-7894-482c-ad39-2566d26ef7c4[^]


这篇关于NotifyIcon没有出现在系统托盘中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆