Switching Windows Forms

A

Andy Bates

Hi -

I'm writing a C# windows form application and have hit a hurdle. The
application has several panels that need to be displayed at various times
depending on what the user is doing. They all need to sit inside a main
frame (form). The various screens could be:

1. Side bar and welcome screen.
2. Side bar and list of items.
3. Item side bar and tab sheet.
4. More variations on 3 replacing the tab sheet etc. etc.

The sidebar will vary depending on what stage the user is at. The other
views will have controls placed on them (i.e. controls on the tab sheet
etc.). The problem I have is how to make the side bar and work panels
dynamic (i.e. to change the state easily to reflect the current mode of the
application). The main problems are:

1. Can I use the IDE to achieve the above or do I need to create the views
by hand? If so how...
2. Do I need to create the various views as separate panels and associate
them with the main form? Can I use the IDE for this and what type should
they be created as?

TIA

- Andy
 
P

Paul E Collins

Andy Bates said:
The application has several panels that need to be
displayed at various times depending on what the
user is doing.
[...]
The problem I have is how to make the side bar
and work panels dynamic (i.e. to change the state
easily to reflect the current mode of the application).

I think I'd create the individual panels as UserControls. These are
custom controls that you create yourself (like "miniature forms" that
can contain many components). You can then either drag them all onto
your form and make only one visible at a time, or create them in code
with something like:

MyUserControl uc = new MyUserControl();
thePanel.Controls.Add(uc); // put the control on the form
// ... set its size, position, etc.

P.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top