R – how to work with multiple coincident panel controls in VS 2008 windows forms

netvisual studiowinforms

in VS 2008, I am attempting to design a windows form that is similar to a set of property pages but uses a TreeView to select the page rather than a TabControl. An example of this design is the Options dialog in VS 2008 itself. There are two reasons I want to do this: 1. I prefer the look and feel; 2. I want to give users the ability to add child nodes to the TreeView.

I am using multiple Panel controls to contain the controls for each "property page". These panels will all be coincident on the form, i.e. overlapping each other. I am finding that the VS UI designer is not very user-friendly when I do this; I can select each panel easily enough, but all the controls inside the panel are visible at the same time, leading to a jumbled mess. Working with a TabControl is much easier, as you can select a tab and only see the controls that you've placed onto that tab.

Is there a different approach that will make this easier for me, or do I have to make do with a TabControl? TIA

Best Answer

In order to get behavior similar to the TabControl where each tab gives you a different designer canvas on which to place controls, you will need to write a designer for your control that provides the tabbing interaction when in the Forms designer. However, if you want to avoid this, you could take the approach we use in a similar situation and make each tab page its own UserControl, then add them as tabs in the constructor of your main tabbed control.

This allows you to design each tab individually, avoiding the overlapping issue you currently face.