Reputation: 67
I currently have a windows form that I am using as a "holder" for many panels. All of these panels are being used like pages, so say I have a default panel, a details panel etc. They all cover the exact same area and i am using a top menu to have buttons to show/hide the correct panel.
The problem I have with this is that I cannot select one panel and edit it or simply bring it to the front to edit it in "design" mode, I currently have to keep sending the top panel to the back until I get the one I need. This is okay now, but eventually my program will have over 20 panel type pages, and this will get tedious.
Is there a better way to manage this, or is there an easier way than using panels?
Upvotes: 3
Views: 1288
Reputation: 1
If you want to keep the panel method there is a way of working around the problem of one panel becoming an element of another. Drag the panel outside the boundary of the other panel (so that it is no longer an element of the other panel) and then re-position it using the arrow keys on your keyboard (i.e. not by dragging it into position over the other panel using the mouse). It seems like the panel will only become an element of another panel if it is dragged into position over the top of another panel using the mouse.
Upvotes: 0
Reputation: 6492
All these panels are used like pages
Above line in your question suggests that you should be using TabPage
instead of Panels.
Therefore, You can use a TabControl
, and add TabPage
to it both at design time as well as at runtime easily, and add controls of your choice to the different TabPage
(s).
According to wikipedia:-
Tab is one that allows multiple documents to be contained within a single window, using tabs as a navigational widget for switching between sets of documents. which is essentially what you want to do.
As shown in the picture
You can then use Button
to switch b/w different TabPage
or show/hide TabPage
.
It will not only solve your problem of designing at design time, it will also provide a "clean" user interface. Hope that helps!
Check this:- http://en.wikipedia.org/wiki/Tab_(GUI)
Upvotes: 4
Reputation: 35891
Use a TabControl
instead. It will allow you to switch an active panel also in design time.
Upvotes: 3