views:

105

answers:

3

I'm trying to decide the best way of having radiobuttons switch around the contents of a panel (or another container), using Windows Forms .NET (C#), and maintaining the ability to use the Visual Studio designer on the form/usercontrol that contains these.

What I'd really like is something like the TabControl where I can select the pages programmatically based on which radiobutton is checked, but without the display of the actual tabs. The reason I'm not just using a tabcontrol is that using the currently selected tab as an input-value seems wrong.

The obvious solution is to simply have a panel for each radiobutton, and switch them around using visibility and such - but this is annoying to work with in the Visual Studio designer, as these panels will either be hidden beneath each other or not in the correct position (and the overall form not in the right size if there's no room for more than the one panel that should be shown at a time.)

I seem to remember Delphi having a PageControl or something like this, which was basically a tabcontrol without the tab-header.

It seems to me that this is a situation that often arises, so I'm curious: How would you set something like this up?

A: 

I guess I would simply build such a page control. Can't be too hard, I guess (even though design time support tend to be a tad more complicated than you would wish for sometimes...)

Fredrik Mörk
I'd like to avoid the design-time work as I have no experience with it. But I suppose it is the most sensible way to go about it, and get some experience with that part of the process.
ulrikj
+1  A: 

I always played with the visibility feature.

Izabela
visibility property :) - not feature
DaDa
A: 

You could design each panel as a User Control. That would give you design-time flexibility. Then, like everyone else says, use visibility when you're manipulating them programmatically.

JJO