我建立一个孩子学习的应用程序,在点击一个按钮面板,我要显示在面板的同一个地方不同的形式。能否请您帮助任何演练或教程链接?
I am building a kids learning application, where clicking on a button on panel, I want to show different forms in the same place of the panel. Can you please help with any walk-through or tutorial links?
这个问题应该被公布在网站上#1,而不是在这里。
This question should have been posted on Stackoverflow website rather than here.
不过你可以用这种方法来处理这种情况。
But you can use this approach to handle the case.
subForm = new SubFormYouWantToLoad();
subForm.TopLevel = false;
subForm.FormBorderStyle = FormBorderStyle.None;
ContainerPanel.Controls.Add(subForm , 0, 1);
subForm .Visible = true;
您可以添加此code,当你点击特定的按钮。 在这里,每个子窗体添加到面板作为对照。你应该添加其他窗体之前,请从面板的控制列表子窗体。对于这一点,最好是去掉,关闭和处置的第一个。
You can add this code when you click on the specific button. Here each subform is added to the Panel as a Control. You should remove the subform from the panel's control list before adding another subform. For this ,it is better to remove,close and dispose the first one.
ContainerPanel.Controls.Remove(activeform);
activeform.Close();
activeform.Dispose();