Question 1:
To allow the form to move when you drag its client area, you must tell the window manager to process the client area as if it were a title bar (title bar). You suggest something similar in your question.
This can be done in .NET by overriding the WndProc method of your form, responding to the WM_NCHITTEST message and returning HTCAPTION to indicate that everything should be considered as part of the header (header), not the default HTCLIENT , which indicates that it should be considered as an area of the client form. Add the following code to the form class:
private const int WM_NCHITTEST = 0x84; private const int HTCLIENT = 0x1; private const int HTCAPTION = 0x2; protected override void WndProc(ref Message m) { base.WndProc(ref m); if (m.Msg == WM_NCHITTEST) {
Question 2:
You can create a shape of any non-rectangular shape by setting the Region property of your shape to a custom Region of your choice. If you have experience working with graphics programs such as Photoshop, you might think of it as setting up a “clipping region” for your form: the window manager will not draw anything outside the boundaries you specify. Pixels in the form described in this Region can even be disjoint.
The easiest way to create your region is probably to use the GraphicsPath class , and then use the Region class , which takes a single GraphicsPath object as a parameter.
And as I assume you already know, given the first question, you need to set the FormBorderStyle property to None to make sure that the default borders created by the window manager disappear.
Unfortunately, these regions cannot be smoothed out. For more information on these restrictions, see Hans for this question .
Finally, it is worth noting that this last approach to creating non-rectangular shapes can lead to some completely ugly user interfaces that do not at all improve the usability of your product, for example:

Use this technique sparingly and use common sense. When in doubt, rectangles are actually really good for windows.