How to set the client area (ClientRectangle) in a borderless form?
06:16 02 Feb 2015

I want to know if it's possible to set the client area of a borderless form. Say for example I define a form like so:

Code

public class MyForm : Form
{
    public MyForm()
    {
        this.FormBorderStyle = FormBorderStyle.None;
    }
}

Result

Form with full client area

What I want to do is specify the client area, so that the form has a frame (like the standard windows frame, but custom drawn).

Result

Form with recalculated client area

Essentially, the blue area would become the non client area, and the gray area would remain as the client area.

I have tried to set the client area, but this just seems to resize the entire form, thus, is does not leave behind a "non-client" area

Is this possible?

c# forms winforms ownerdrawn nonclient-area