I have to define the size and position of the form's client area.
I have viewed this link and used the below code for defining the client area of the form.
private void On_Wm_NcCalcSize(ref Message m)
{
NativePaint.RECT rect = new NativePaint.RECT();
NativePaint.GetWindowRect((int)this.Handle, ref rect);
rect.top += CaptionHeight;
rect.left += borderWidth;
rect.right -= borderWidth;
rect.bottom -= borderWidth;
Marshal.StructureToPtr(rect, m.LParam, true);
}
It works perfectly. But I can't able to understand the purpose of the method call Marshal.StructureToPtr(rect, m.Lparam, true).
I have analyzed about this here. But I can't understand the reason for using the method in this scenario.
Is this the only way to customize the client area?
Can anyone please share your knowledge.