How can I get rounded corners in a GroupBox in my form? Is there any option in the property tab?
Asked
Active
Viewed 1.0k times
4
2 Answers
5
When visual styles are enabled for your application and the FlatStyle
property is set to "System", the group boxes look like they have slightly rounded corners, but it's probably no more than 3 to 5 degrees. So I suppose this is not what you're looking for.
Unfortunately, there's no built-in way to customize its degree of roundedness. The only real solution is to use a custom control. You can either inherit off of the existing GroupBox
control and override its Paint
event to draw the borders yourself, or you can use one of these existing controls:

Cody Gray - on strike
- 239,200
- 50
- 490
- 574
-
Just overdraw the control over a bitmap with the right corners' shape ;) – TomeeNS Mar 22 '14 at 22:35
-
The last one is the best for me. Worked fine. I'm just trying to figure out how to put it in my toolbox as in the demo source code. – Jack Feb 01 '16 at 00:17
-
@Jack Not entirely sure what you mean, but if you want a custom control to appear in your toolbox, you can try turning on Options -> Windows Forms Designer -> AutoToolboxPopulate. That way, when you rebuild the solution, user controls will appear automatically in your toolbox. – Cody Gray - on strike Feb 01 '16 at 06:00
-
See also: http://stackoverflow.com/questions/8931328/how-do-i-add-my-new-user-control-to-the-toolbox-or-a-new-winform – Cody Gray - on strike Feb 01 '16 at 06:00
-
@CodyGray: In the demo project the custom rouded group box control is available on the toolbox so you can drag-and-drop it. I want to do the same to my project, importing the dll as right click toolbox -> select intem -> browse dll didn't worked so I created an empty cs file and added a class `public class MyGrouper : Grouper { }` so that it gets added in the toolbox automatically (as it's a class that inherit from a control) after the first compilation. This isn't really a elegant solution but was how I managed to do it. – Jack Feb 01 '16 at 17:30