Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有一个名为“FormA”的表单,其中包含两个文本框 text1_a 和 text2_a。如何在运行时动态创建一个名为“FormB”的表单,其中 FormA 中的相同对象具有相同的布局,但文本框的名称不同,例如text1_b 和 text2_b
试试这个代码:
FormA cloningForm = new FormA(); cloningForm.Show(); cloningForm.Name = "FormB"; cloningForm.text1_a.Name = "text1_b"; cloningForm.text2_a.Name = "text2_b";