我已使用此代码在 MdiWindow 中制作和显示表单:
if (currentForm != null) {
currentForm.Dispose();
}
currentForm = new ManageCompanies();
currentForm.MdiParent = this;
currentForm.Show();
currentForm.WindowState = FormWindowState.Maximized;
我用这段代码显示了大约 20 种不同的形式......
我想写一个这样的函数:
private void ShowForm(formClassName) {
if (currentForm != null) {
currentForm.Dispose();
}
currentForm = new formClassName();
currentForm.MdiParent = this;
currentForm.Show();
currentForm.WindowState = FormWindowState.Maximized;
}
我是否必须将 formClassName 作为字符串或其他内容发送;以及如何将其包含在代码中...我想要最终代码...