views:

1042

answers:

1

Warning: I'm new to GUI building in C# (come from a long history in Java with Swing and SWT.)

Using VS2008, When I create a new class, and extend System.Windows.Forms.Form, the WinForms Designer works really nicely. However; when I create a new class and extend System.Windows.Forms.Panel, the designer does not work nearly as elegantly - it simply shows some kind of abstract, list-type view of the components contained in the Panel (as opposed to showing the actual layout of the Controls in the Panel.)

Is there a way to get the Designer to work more nicely with a Panel?

Or is there some workaround so that I can build a Form with the designer, and then use it as if it were only a Panel?

What I'm really looking for is some UI 'element' I can build with the designer, and then dynamically (read: programmatically) add/remove that 'element' to a larger UI.

+9  A: 

I think what you're looking for is a UserControl. You can inherit directly from that, and you should be able to use the designer to drag and drop stuff on it.

To make it even easier, you can just right click on your project and click Add -> User Control. That will create the .cs file for you as well as a partial .cs file for the designer generated code.

BFree
10 seconds!! +1
leppie
haha...I post the question, go down the hall to the bathroom, return, and the apparently-correct answer is waiting on me. The genius of stackoverflow :P. Will accept as soon as I confirm that this works for me. Thanks.
Jared