20

On the System.Windows.Forms.GroupBox, is there any way to hide frame around it? I tried changing the FlatStyle but that does not do what I want. Thanks!

Luis Garcia
  • 1,311
  • 6
  • 19
  • 37
  • 5
    Isn't that the point of a group box? If you don't want the frame why not just use a Panel with a Label for the title? – Lloyd Feb 25 '13 at 15:10
  • 4
    There are many scenarios in programming, the fact that "the point" of something is a fixed paradigm does not mean that you cannot change it a little bit and get something else, that solves a different problem... which is what the answer left by Bobso provides and what I needed. thanks for your input! – Luis Garcia Feb 26 '13 at 14:22

3 Answers3

25

A Panel is probably a better option, but if you really need a GroupBox for some reason, you can modify the code here to create a subclass which doesn't paint the border at all. Specifically, you'll want to override the OnPaint method.

Bobson
  • 13,498
  • 5
  • 55
  • 80
  • If you don't want to mess with subclasses, adapt the solution [here](https://stackoverflow.com/a/20042058/6674014). Remove the size and rect, and the line draws. – DCOPTimDowd Dec 04 '19 at 18:33
5

As far as I know this is not possible.

Try using a panel instead.

You could put a label at the top if you want and they practically do the same thing.

Toon Casteele
  • 2,479
  • 15
  • 25
2

There is not (short of custom painting code). I think a Panel be better control to use here, although you don't get the text header (just add a label if you need one).

Pondidum
  • 11,457
  • 8
  • 50
  • 69