views:

171

answers:

5

So I am designing a control with a window s form. I want to group some controls together with a caption. So naturally I would go with a GroupBox. However is there some advantage in using a panel instead? Something not immediatly obvious to one who is still a little green with form design? How about some "gotchas" as well.

+1  A: 

A groupbox may have a caption, whereas a panel may not. A Panel may have scroll bars whereas a group box may not.

Otávio Décio
A: 

Another note, groupbox is not scrollable

Jason Watts
+3  A: 

Some Advantages of Panel:

  • Scrollable
  • Lots of border style options.

An Advantage of GroupBox:

  • Group Title
Matthew Jones
A: 

A Group Box just provides a graphical outline of the extent of the container, and a caption at the top. A panel can scroll it's contents automatically, where as a group box would not be able to without some form of intervention (Panel inside a group box).

http://bytes.com/groups/net-c/251762-panel-v-groupbox

CoderTao
Seems like a question for the ages apparenetly. Maybe M$ could have made one control for both cases
Mike T
+1  A: 

The Panel control is similar to the GroupBox control; however, only the Panel control can have scroll bars, and only the GroupBox control displays a caption.

Also border styles of GroupBox and Panel are different

In most cases Panels are used when you want to group several controls and apply an Anchor or Dock for the whole group.

Very seldom panels have borders. If you like a caption and border around a group of controls, using GroupBox will be more natural.

Bogdan_Ch