Question change the style of the group box

Mehran

Member
Joined
Aug 18, 2021
Messages
6
Programming Experience
Beginner
32.png

How can I change the style of the groupbox exactly like what you see in the picture?
Similar to the part I highlighted in the image
 
Solution
Why do you have to change the style of a group box? Why not just draw things using GDI or GDI+? Since WinForms is just a thin wrapper around Win32, you get the default Win32 rendering of controls. The normal way to override a Win32 control rendering is to make it an owner drawn control. When you start doing owner drawn painting, you'll use GDI and/or GDI+. If all you need to do is a one-off drawing, why even do through the trouble of doing an owner drawn static control? Just draw it directly as part of the window paint of the parent window/form.

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
5,488
Location
Chesapeake, VA
Programming Experience
10+
Why do you have to change the style of a group box? Why not just draw things using GDI or GDI+? Since WinForms is just a thin wrapper around Win32, you get the default Win32 rendering of controls. The normal way to override a Win32 control rendering is to make it an owner drawn control. When you start doing owner drawn painting, you'll use GDI and/or GDI+. If all you need to do is a one-off drawing, why even do through the trouble of doing an owner drawn static control? Just draw it directly as part of the window paint of the parent window/form.
 
Solution

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
5,488
Location
Chesapeake, VA
Programming Experience
10+
@titojd : Unfortunately, your link is for WPF, but the question was about WinForms.
 
Top Bottom