-1
所以我有两种形式的项目:MainForm和AnotherForm。 在MainForm中,我有一个应该打开AnotherForm的按钮。我使用下面的代码来做到这一点:打开新窗体重设设计?
private void btnTimeReminder_Click(object sender, EventArgs e) {
AnotherForm anotherForm = new AnotherForm();
anotherForm.Show();
this.Hide();
}
的问题是,当我点击按钮,打开“AnotherForm”,它只是打开在WindowsDefaultPosition空白表单。 AnotherForm的所有设计都被删除(按钮,图像,甚至AnotherForm的大小)。
我不知道为什么会发生这种情况...我是否使用错误的代码打开表单?
你确定你正在初始化正确的表单吗? –
我该如何检查?对不起,我是新来的C#。我正在使用visual studio 2015. – Ravers
当'AnotherForm'的构造函数正在运行时,没有调用设计器代码的声音。 – xxbbcc