在一个窗口中窗体之间切换 [英] Switching between to Forms within a single window
问题描述
我要改变我的形式到1 2的形式,我不希望它打开一个新的窗口,但保持在同一个窗口,然后可以来回走,当我按下一个键或返回键。是通过单独隐藏每个按钮和画面做到这一点的唯一途径?
I want to change my form 1 into form 2. I don't want it to open a new window but keep it in the same window and then be able to go back and forth when I press the Next key or back key. Is the only way to do this by Individually hiding each button and picture?
推荐答案
您可能要考虑不同的方法。
You might want to consider a different approach.
您不能改变一种形式的成不同类型的表单。最接近的选项是关闭或隐藏在第一,并显示在屏幕上的同一位置第二。
You can't change one type of form into a different type of form. The closest option would be to close or hide the first and show the second at the same location on the screen.
不过,你可以不同的方法处理这一点。而不是把你的按钮和逻辑到一个窗体,你可以把一切都变成两个用户控件
实例,只是改变它的用户控件是一个单一的形式中可见。
However, you could approach this differently. Instead of putting your buttons and logic into a form, you could place everything into two UserControl
instances, and just change which user control is visible within a single form.
这篇关于在一个窗口中窗体之间切换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!