Jump to content
  • Advertisement
Sign in to follow this  
BrknPhoenix

C#/.NET - Attaching multiple sets of controls/layouts to one window

This topic is 4017 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Noobish C# question ahead! Most of my programming to this point has been in C++, but I've taken a liking to C# recently. Unfortunately some of the differences are throwing me off a bit. I was wondering if there is a simple way to link multiple sets of controls to the same window. For example, you are on a menu, you click a button, the menu buttons disappear and a whole other set of controls appear in the same window. Just basic functionality like that. I'm sure there has to be a simple way to do it considering I'd think it'd be a fairly typical task that someone would want to do, but I dunno, maybe not. I just wanted to be able to take advantage of the simplicity of the form designer on all of my screens without having to create and destroy new windows. Previously one method I used was splaying every control out on the form and controlling their visibility in the code, which was very silly and inconvenient indeed.

Share this post


Link to post
Share on other sites
Advertisement
Usually we use Tab Pages for that.

Relevant controls: TabControl / TabPage.

Usage: Create one TabControl over the visible area you want to have "swap", then add TabPages for each set of controls you want to be able to swap in. Add controls as children of the TabPage you want them to appear on.

Benefit over making your own hide/show panel: The form designer knows how to hide/show each TabPage at design time which makes laying everything out on the pages very quick and easy.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!