Click here to Skip to main content
11,927,378 members (45,253 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# GUI

All we know that developing a GUI is very important, i was developing a configuration module for a project into that there were many settings like user setting, software setting, font setting.

For each setting i had taken separate forms. I had a following menu:

- User Setting
- Software Setting
- Font Setting

On each click of sub-menu item i am redirecting to respective form.

Instead can we do in single form where user will select appropriate option and accordingly besides screen will be changed. Like we have tabs on every tab click screen changes on single form.

Like when we go to Project properties of project in visual studio.

Can any one suggest a way to do it single Form?

Thanks and Regards,
Posted 5-Oct-10 20:51pm
Edited 5-Oct-10 20:52pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Why not use a tab control? This is what I've seen most commonly. Or you could stack panels and your submenu control could bring the correct panel to the top of the z-order.
prashant joseph 6-Oct-10 4:31am
Actually i have more number of such screens... So it would not look good. That's why i am not preferring. In second case there would me complexity for designing such number of panel in single .cs file.
gkushner 6-Oct-10 4:46am
You could make the application an MDI (multiple document) so that the container form has the menu and you actually load and unload child forms. If you make the child forms maximized, they appear to be part of the main form. Just a thought.
Toli Cuturicu 6-Oct-10 15:17pm
Better not.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Do one thing make a panel and make user control forms instead Forms. Make the panel as visible when particular Menu item selected so that they will be shown in the same form. Make particular user control visible based on your selection.

A small code

//Under Menu selected Item


Like this load the corresponding user control.
Rate this: bad
Please Sign up or sign in to vote.

Solution 5

Use something like Panels. Stack them, as pointed before by a fellow programmer. But don't design them all in a class.
Create a base class:
public class MyTab : UserControl
Then, make and design your individual tabs in individual files:
public sealed class MyFirstTab : MyTab
public sealed class MySecondTab : MyTab
And so on...
Finally, in your Form:
private List<MyTab> myTabs = new List<MyTab>();
Add the tabs to the List:
myTabs.Add(new MyFirstTab());
myTabs.Add(new MySecondTab());
And add them to the Form:
So, when you need one of them, you just have to remember its ordinal number. (If you want to refine it, you may store them in a Dictionary<string, MyTab> and refer them by name instead)
Hope that helps.
An Accept Answer helps me too Wink | ;-)
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

You should use the panel control ,so that you will be able to dispaly or hide a particular form when u need it.
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

You can keep separate forms and code behind for each settings.
Create a main form and add each form on menu click.
It will be good if you use Microsoft UIP Application block for windows form projects.

Sajith OD

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web03 | 2.8.151126.1 | Last Updated 6 Oct 2010
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100