How can one select from overlapped panels in the form design View?

J

Jim Brandley

I am building a Windows Form App that has a splitter in the client area,
treeview on the left, and panels on the right. Different classes of tree
nodes need different views. How can I cause the one I want to work on (say
add or remove a control) to pop to the top of the z order in the design
view? I have tried about everything I can think of, without success. Bring
to top and send to bottom do not seem to do what I expect. Google revealed
nothing. Any help would be much appreciated.
 
C

Chris Dunaway

What I have done is, instead of using multiple panels, use a single
panel and for each view, I use a form with no caption and no border.

So for example,

you have a tree view on the left, a splitter in the middle, and a
single panel on the right side with docking set to fill.

Then in the code, when a particular node is selected for which you need
to display a view, just instantiate the form, set it's parent property
to the content panel and then show the form inside the panel. Then to
edit a particular view, you can just edit the form.

An alternative would be to use a tab control and place it so the tabs
are outside the boundary of the panel, or use a tab control that
supports tab pages in which you can hide the tab. The tab control in
the Magic library can do this, but the Magic library is not free.
Anyway, hope this gives you some ideas.

Chris
 
J

Jim Brandley

Thanks for the tip! I'll try that. I started with a tab control, but that
didn't work well for the data with which I'm working.
 
C

Chris Dunaway

By the way: be sure to set the Form's TopLevel property to false,
otherwise you wont be able to show it inside the panel.
 
R

rogercnorris

I've worked on several programs like that, and I think the following
solution will suit your needs, with no need to recode anything:

1) Open your form in the Designer.

2) On the Properties panel, use the top ComboBox to select the panel
which you want to display.

3) Next, give input focus back to the form designer by clicking on the
tab for your form (even though it's already selected).

4) After the previous step, the "Bring to Front" toolbar button should
now be enabled. Press this button to bring your selected Panel back to
the front of the Z-Order, so that you can work with it.
Hope that answers your question!
 

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