简体   繁体   English

重命名WinForms表单的标题

[英]Rename title of WinForms form

How do I rename the name of already created Windows Form? 如何重命名已创建的Windows窗体的名称? Currently, its default name is Form1 and when the application runs its name is shown in the top-left side of window. 当前,其默认名称为Form1 ,当应用程序运行时,其名称显示在窗口的左上方。 How do I rename this text to MyForm ? 如何将此文本重命名为MyForm

Refactoring changes the name of the .cs files, but the text in window does not change. 重构会更改.cs文件的名称,但窗口中的文本不会更改。 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. 此外,我尝试使用Project->Properties->Browse to the location of the .ico file来更改表单的默认图标,但默认图标没有更改。 Why doesn't that work? 为什么不起作用?

You would need to change the Form's Text property; 您将需要更改Form的Text属性;

This can be done VIA the properties or within code; 这可以通过属性或代码完成;

在此输入图像描述

Or (from the constructor) 或者(来自构造函数)

this.Text = "MyForm";

Hope this helps? 希望这可以帮助?

在设计器模式下更改窗体的Text属性。

在设计器模式下更改窗体的Text属性

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM