问题
A client has asked me to remove the icon from the form's title bar. As they don't want to display any icon. But this me guessing as when I click on the icon property you have to browse to some icon.
回答1:
Set ShowIcon Property of the form to False to see if that's what your client wants.
回答2:
There are two ways.
First is to create an empty Icon file and then Select Form -> Right Click -> Goto Properties -> Goto Icon -> Select your file.
The other approach is to set FormBorderStyle of the form to FormBorderStyle.SizableToolWindow or FormBorderStyle.FixedToolWind
And one more way is to set ShowIcon property to be false.
回答3:
Set
FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
回答4:
You can set ControlBox = false. However, that will remove not only the icon but also maximize and minimize buttons from the title bar.
回答5:
There appears to be an updated process. Following the steps in the selected answer doesn't direct me to an option to upload an icon. That option can be found on Microsoft's site: https://support.office.com/en-us/article/add-a-custom-title-or-icon-to-a-database-0e43e135-dd0d-4451-84ea-4f547e14480e
回答6:
You can also try this:
this.Icon = null;
回答7:
Icon > False
This COULD be a good approach, but these are good too:
this.Icon = null;
//Or
FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
//Or
Select Your Form -> Right-Click -> Properties -> Icon -> Select file
That's all I have for this, I hope this helps you.
来源:https://stackoverflow.com/questions/784717/c-sharp-2005-remove-icon-from-the-forms-title-bar