主窗体未显示在任务栏中
主应用程序表单不显示在任务栏中的原因可能是什么?
ShowInTaskbar 属性设置为“true”,但如果在运行应用程序之后且在主窗体出现之前我切换到其他窗口,则窗体不会显示自己。表单存在,但在我最小化上面的应用程序以使其可见之前,它不会显示在任务栏中。
更新。表单没有所有者。
What could be the reasons for the Main application form not to be shown in TaskBar?
ShowInTaskbar property is set to "true", but form doesn't show itself there if after running the application and before the Main form appears I switch to some other window. Form exists, but until I minimize apps that are above to make it visible, it won't show in Taskbar.
UPDATE. Form does not have an Owner.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我在 form.Show() 之后添加了 form.Activate()。现在它总是在完全加载时跳出,并且不会在其他一些屏幕下丢失。
虽然这不是一个解决方案,而是一个拐杖,但无论如何都欢迎回应。
I've added form.Activate() after form.Show(). Now it always jumps out when completely loaded, and doesn't get lost under some other screens.
Though it is not a solution, but a crutch, responses are welcome anyway.
检查您的主表单是否定义了父级或所有者。无论哪种情况,都会将其排除在任务栏中。也值得尝试 TopMost=true。
Check if your main form has a Parent defined or an Owner. In either case that would exclude it from being in the task bar in its own right. Also worth trying TopMost=true.
我写的一个项目也有同样的问题。
除非我强制 Windows 刷新它,否则任务栏中不会显示任何图标。
的调用
这是对this.MinimumSize = new Size(wid, len);
在 Form_Load 中这就是问题所在。
I had the same issue with one project I wrote.
No icon showing in the Taskbar unless I forced Windows to refresh it.
It was a call to
this.MinimumSize = new Size(wid, len);
In the Form_Load that was the issue.
当程序从安装程序(在我的例子中为InstallMate)运行时,我遇到了类似的问题。我最终将问题归结为在 Form1_Load() 方法中更改表单的标题文本(文本)。当我将该标题更改文本移动到 InitializeComponent() 的正下方时;一点,问题就消失了。
尽管我的情况特殊,但我希望这可以帮助其他人。
I had a similar issue when the program was run from an installer (InstallMate in my case). I eventually pinned the problem down to changing the form's title text (Text) in the Form1_Load() method. When I moved that title changing text to just below the InitializeComponent(); bit, the problem went away.
I hope this can help someone else, despite the specificness of my circumstances.
我遇到了与@deegee相同的问题,在表单加载中设置MinimumSize导致任务栏中不显示。我通过将“Form Visible”设置为“False”然后设置为“True”解决了该问题。
I had the same issue as @deegee where setting MinimumSize in the Form Load causing the non display in the Taskbar. I fixed the issue with setting the Form Visible to False then to True.