I am making simple graphical game in WinForms and currently I would like to have a menu displayed when the game starts. My only problem is that I am not sure regarding the structure of the application itself, this is what I have so far:
1) To have a Menu form and Game form. When New game is selected, create Game form and dock it to Menu form – I cannot dispose Menu form as the app would exit. Or can I switch the messageloop to different form? I doubt so
2) To have some main form that enables me to create and dispose both menu and game forms
3) Entirely different way?
One way I’m using frequently when developing applications is to use the main form as a container for views (a view being a
UserControl), containing a panel to add the views to.What you could do is:
The following pseudo-code will help you switch views:
Please note that this code may not compile properly, I writing this from my head. But it will give you a general idea of this can be done.