Why does my icon not appear in the title bar?

∥☆過路亽.° 提交于 2021-02-07 06:44:05

问题


I have assigned an icon to my application from the Properties window in Solution Explorer in Visual Studio; the application's icon changed successfully but the title bar is still showing the default icon:

The title bar, showing the default icon

I've rebuilt my application but it still displays the default icon. What am I doing wrong?


回答1:


Because forms have a different icaon configuration than the application. Set the icon on the form, not ONLY on the application.




回答2:


The form itself has an Icon property you need to set as well.




回答3:


I know that it is a very old issue but I can add the following comment :

Pay attention to the 'FormBorderStyle' property. If 'FixedToolWindow' or 'SizableToolWindow' are selected, your icon will not appear, even if you specified an icon in the 'Icon' property. I encountered the same issue. Good luck.




回答4:


There is another reason why the icon might not show.

If the ControlBox property of the Form is set to False the icon will not show.

(Sounds like an undesired side effect)




回答5:


If you using winform you need to set the icon property of your main form




回答6:


You didn't mention if you are using winforms or wpf - wpf will place the icon on all windows/forms unless overridden.

Winforms requires individually set icons.



来源:https://stackoverflow.com/questions/14547969/why-does-my-icon-not-appear-in-the-title-bar

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!