C# 重命名 WinForms 表单的标题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17990499/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Rename title of WinForms form
提问by Nurlan
How do I rename the name of already created Windows Form? Currently, its default name is Form1
and when the application runs its name is shown in the top-left side of window.
How do I rename this text to MyForm
?
如何重命名已创建的 Windows 窗体的名称?目前,它的默认名称是Form1
,当应用程序运行时,它的名称显示在窗口的左上角。
如何将此文本重命名为MyForm
?
Refactoring changes the name of the .cs files, but the text in window does not change.
Moreover, I tried to change default icon of the form by using Project->Properties->Browse to the location of the .ico file
, but the default icon didn't change. Why doesn't that work?
重构会更改 .cs 文件的名称,但窗口中的文本不会更改。此外,我尝试使用 更改表单Project->Properties->Browse to the location of the .ico file
的默认图标,但默认图标没有更改。为什么这不起作用?
回答by Moo-Juice
Change the Text
property of the Form in designer mode.
Text
在设计器模式下更改Form的属性。
回答by Hexie
You would need to change the Form's Text
property;
您需要更改表单的Text
属性;
This can be done VIA the properties or within code;
这可以通过属性或在代码中完成;
Or (from the constructor)
或者(来自构造函数)
this.Text = "MyForm";
Hope this helps?
希望这可以帮助?
回答by Deadlock
Change the Text propertyof the Form in designer mode.
在设计器模式下更改Form的Text 属性。