How to create a custom non-rectangular GroupBox?

Is it possible to make a GroupBox that looks like the image below?

If this is not possible with your own controls, are there any free user controls that can support this?

alt text

+4
source share
3 answers

There is no control, like the image that you created, I do not have an intelligent solution, but can meet your requirement,

Create a UserControl and insert two GroupBox controls GroupBox , then you will have a line between them, you can hide it by adding a panel above it without None for BorderStyle .

Then you will have this user control:

alt text

I know that this is not as reasonable as you want, but it may be easier than drawing from scratch and losing the subject.

You can also create a title property to reflect the vertical group box as the title of a user control

 public string Title { get { return groupBox1.Text; } set { groupBox1.Text = value; } } 

Good luck

+5
source

No, such control does not exist within the framework. You can do this yourself by creating a control that inherits GroupBox.

+6
source

You will not find such a control. You can do it yourself, the Control.Region property allows you to create a non-rectangular control. You will need to draw the outline and name yourself, do this in the OverPaintBackground override.

But, realistically, this control will not be very interesting as a reusable control that can be useful in other forms or projects. Keep in mind that it should only look like a group box for the user. Since you must still write the drawing code, just do it in the Paint event. If you really need a box due to the radio volumes, then use the panel. Observe the Form.AutoScaleMode property, you cannot hard-code line positions.

+3
source

Source: https://habr.com/ru/post/1334747/


All Articles