Connor Albright
Connor Albright

Reputation: 743

Building a gui with lots of controls in Visual Studio

This is all new to me so this is a rather broad open ended question, extra information welcome!

I am building a gui with a lot of inputs/controls. There are several pages of controls, which effectively are placed on top of each other, only shown at different times. I have the issue that the controls are becoming layered on top of each other. How can I avoid all this clutter?

I could add controls dynamically though my code, but I lose the advantage of the drag and drop gui. Also, I have no idea how events would work.

How do I create several pages worth of controls using the gui designer and not layering controls on each other?

Upvotes: 2

Views: 380

Answers (3)

veljkoz
veljkoz

Reputation: 8512

One way would be to use TabPage to organize your controls into several pages, and show/hide only tabs that are in use. The benefit of this is that all of the pages are available to you in design time, but you might not want the user to see that he's on a tab control...

If that's not what you're after, than organizing them inside a UserControl (as Danial Hilgarth suggested) is the way to go. Basically, you create a user control for each of the "page" that holds all of the controls and behaviors for that page. When you need to switch between them - just use the 'visible' property.

The other way (if you really don't like user controls) would be to place everything on panels, but that would obscure you in design time...

Upvotes: 2

Daniel Hilgarth
Daniel Hilgarth

Reputation: 174467

Essentially, what you have here, are different views. I suggest, you create every view in its own user control and than add those to your form.

Upvotes: 2

Max
Max

Reputation: 3190

(sorry, I gave answer with MFC in mind, but there should be equivalent in C# or vb.net )

  • Have a look at propertysheets and propertypages (CPropertySheet and CPropertyPage)
  • Manually manage different modeless and borderless CDialog that you can show/hide independently.
  • Review your UI and question yourself if you really need that many controls.

Max.

Upvotes: 0

Related Questions