views:

1380

answers:

3

The closest I can think of using is the GroupBox control which has a custom drawing at the top identifying the panel.

Is it doable? I have done independent custom controls like buttons, sliders, color pickers, but not totally sure if this sort of drawing can be done on a GroupBox?

I would need the grouping of a GroupBox or a TabPanel.

Are there any alternatives on the net that I can use?

Just exploring the alternatives before I start doing it.

+1  A: 

A technique we used was to create multiple panels docked to the top of a frame and set their height to zero. Then when we wanted to display a panel we set its height correctly. Winforms automatically reflows other panels to accommodate the new one.

You can also create a recurring timer to trigger every few hundred milliseconds that increases the panel's height by a few pixels until it reaches full size. This creates a nice animation of the panel expanding into place.

Dour High Arch
+1  A: 

Why not just create a composite control? Something to the effect of.. 2 panels or a label and a panel or whatever suits your needs. Drawing it wouldn't be all that difficult but seems overly complicated for your desired functionality. Am I completely missing the mark?

Quintin Robinson
How do you create a composite control? You mean you can have a single control that's built with more than 1 control and customize them as a single control?
Joan Venge
Absolutely, just think about it in terms of being OO, you can do basically whatever you want. Create an object that inherits from UserControl/Control (it's up to you and your needs). Then you can create your component however you see fit with whatever functionality you require. Given you have already created your own custom controls I would imagine this would be a trivial task.
Quintin Robinson
Just a side note, if you need container functionality remember to implement IContainerControl and decorate the object with the appropriate designer attribute for designer container support.
Quintin Robinson
Thanks Quintin, will check this out.
Joan Venge
No problem, I just hope i'm not steering you in the wrong direction.
Quintin Robinson
No this seems very sensible. I just didn't know one could do these kinds of controls. Surely I have both the header as a separate control and a custom groupbox, I just assumed I had to write one that has both. Now it seems that I don't.
Joan Venge
+2  A: 

See how others have done this. Code Project's got a bunch. Try searching there.

I used this one a while ago and liked it:

Windows XP style Collapsible Panel Bar

Jay Riggs