【发布时间】:2011-02-18 05:52:28
【问题描述】:
我已经使用 Windows 窗体构建了一个触摸屏应用程序。 效果很好,但我仍然想获得一些设计建议。
我的应用程序由几个不同的窗体组成。
我的设计是我有一个 MainForm,所有其他表单都继承自它。在这个 Mainform 中,我有用户可以选择打开哪个表单的按钮。 当用户选择其中一个选项时,会打开另一个表单。我使用以下代码:
Control control = this; // the current form, that is open
Recording rec = Recording.Instance; // the form that the user choose to open
if (control != rec) {
rec.Show(); // show the recording form
control.Hide(); // hide the previous form
}
这是处理表单的正确方式还是应该使用其他方式?例如,其中包含一个表单和用户控件。
【问题讨论】: