You can resize the form using the WndProc method. Take a test with the code below:
public partial class Form1 :Form
{
public Form1()
{
InitializeComponent();
}
private int borderWidth = 5; //Exemplo apenas para teste
private new Padding Padding = new Padding(50); //Exemplo apenas para teste (Pode ser especificado direto nas propriedades do Form)
private WinApi.HitTest HitTestNCA(IntPtr lparam)
{
Point vPoint = new Point((Int16)lparam, (Int16)((int)lparam >> 16));
int vPadding = Math.Max(Padding.Right, Padding.Bottom);
if (RectangleToScreen(new Rectangle(ClientRectangle.Width - vPadding, ClientRectangle.Height - vPadding, vPadding, vPadding)).Contains(vPoint))
return WinApi.HitTest.HTBOTTOMRIGHT;
if (RectangleToScreen(new Rectangle(borderWidth, borderWidth, ClientRectangle.Width - 2 * borderWidth, 50)).Contains(vPoint))
return WinApi.HitTest.HTCAPTION;
return WinApi.HitTest.HTCLIENT;
}
protected override void WndProc(ref Message m)
{
if (DesignMode)
{
base.WndProc(ref m);
return;
}
switch (m.Msg)
{
case (int) WinApi.Messages.WM_NCHITTEST:
WinApi.HitTest ht = HitTestNCA(m.LParam);
if (ht != WinApi.HitTest.HTCLIENT)
{
m.Result = (IntPtr) ht;
return;
}
break;
}
base.WndProc(ref m);
}
[SuppressUnmanagedCodeSecurity]
internal static class WinApi
{
public enum Messages : uint
{
WM_NCHITTEST = 0x84,
}
public enum HitTest
{
HTCLIENT = 1,
HTBOTTOMRIGHT = 17,
HTCAPTION = 2
}
}
}
* Note that the Padding property will determine the area in which resizing may occur, in this case a square area of 50 pixels in the lower right corner.
This code snippet was taken from a framework developed to create Metro-style applications using Windows Forms:
MetroFramework - Modern UI for WinForms ( link )
If the forms and controls they provide do not meet your requirements, you can get the source code and make any necessary changes.