0
C#的WinForms,VS2015如何重命名一個winform不重新命名類
在設計師,如果我重新命名CustomerForm到frmCustomer,類也被改名爲frmCustomer。我希望我的課程保持不變(CustomerForm)。由於
C#的WinForms,VS2015如何重命名一個winform不重新命名類
在設計師,如果我重新命名CustomerForm到frmCustomer,類也被改名爲frmCustomer。我希望我的課程保持不變(CustomerForm)。由於
你可以去到設計代碼並更改名稱有:
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// CustomerForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 261);
this.Name = "frmCustomer";
this.Text = "Form1";
this.Load += new System.EventHandler(this.CustomerForm_Load);
this.ResumeLayout(false);
}
#endregion
並不總是一個好方法,因爲設計者可能揍隨時這種變化。
你不能只是改變代碼,'公共類frmCustomer'回到'公共類CustomerForm'?設計師在那裏幫助改變代碼引用。 – Bugs
我使用了Resharper來做到這一點,但實例也被改回CustomerForm而不是frmCustomer – user1104916
對不起,我明白你的意思了。設計器屬性** Name **將與代碼相同,因此'Public Class CustomerForm'將與設計器中的屬性** Name **相同。不幸的是,我不認爲它可以改變爲不同的。 – Bugs