I want to create a simple 3D line in a WinForms application to improve visual arrangement of my form layout.
This line is exacly like the line in About Windows dialog (can be opened in Windows Explorer -> Help -> About Windows).
An example be checked
The last line (3D) is the one I want, not the first one.
How can this be done in C# or Visual Basic (.NET)?

If you use SysInternals’ ZoomIt utility, you can see that this is simply two lines. A dark gray one above a white one. Drawing lines is simple enough with Graphics.DrawLine(), you just need to make sure you pick a dark color that work well with the form’s BackColor. That isn’t always battleship gray if the user selected another theme. Which makes the GroupBox trick fall flat.
This sample code is serviceable:
Note the use of
button1in this code, there to make sure the line is drawn at the right height, even when the form is rescaled. Pick your own control as a reference for the line.