Switching between to Forms within a single window

后端 未结 2 1798
一个人的身影
一个人的身影 2021-01-24 00:43

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 b

相关标签:
2条回答
  • 2021-01-24 01:01

    You can use panels, group boxes, TabControls, etc. to group common controls together. When you want to switch between different "screens", you can hide or show the group control by setting the visible property and calling BringToFront(), and it will hide/show all the controls on that group control.

    0 讨论(0)
  • 2021-01-24 01:06

    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.

    0 讨论(0)
提交回复
热议问题