Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Multiple GUIs With One Window in Window Form [closed]

Tags:

c#

winforms

My friend and I are trying to work on a text game using Visual Studios Community. As of now, we have started our project in windows form. One thing we are stuck on is being able to design multiple screens but using only one window. As of right now, the way we have it designed is after you click "Start Game" on the first window, it pops open a second window to the character select screen. Once you select a character, it opens a third window.

What we would rather do is be able to design the GUI to display a basic opening splash screen and clicking on "Start Game" would bring up a new "screen" but in the same window. The new screen should have it's own unique GUI from the initial splash screen. Also part of the game, we are going to want to put a pause menu with options. When the user clicks on the pause button, that should bring up a new "screen", again with it's own unique GUI from the main screen you would see during the game.

Is it possible to create multiple GUIs but only using one window in window form? If not, how could we make something like that happen?

Thanks in advance!

like image 505
R1zzo23 Avatar asked Jan 12 '15 12:01

R1zzo23


People also ask

What is the full name of C?

In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr.

What is C in C language?

What is C? C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972. It is a very popular language, despite being old. C is strongly associated with UNIX, as it was developed to write the UNIX operating system.

Is C language easy?

C is a general-purpose language that most programmers learn before moving on to more complex languages. From Unix and Windows to Tic Tac Toe and Photoshop, several of the most commonly used applications today have been built on C. It is easy to learn because: A simple syntax with only 32 keywords.

What is C language used for?

C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...


1 Answers

You have to use UserControl in this case. A UserControl can be set up as a whole form, then you simply swap the UserControls that you have created.

In visual studio create a UserControl item, put your user interface in them, basically very similar to designing a normal Form you just put buttons, labels and other stuff on it and wire up events and logics and you are ready to go.

You propably need to implement a global logic or business model to handle or pass the events of each usercontrol you are creating to have a unified model accross your application.

Here is a good tutorial on using UserControl

You can also apply transition animations while swapping between different controls, anyway if you google these stuff up you will find plenty of useful data.

like image 129
Saeid Yazdani Avatar answered Nov 14 '22 01:11

Saeid Yazdani