Answers for "resize form in C# winform"

C#
1

resize form in C# winform

[DllImport("user32")]
private static extern bool ReleaseCapture();

[DllImport("user32")]
private static extern int SendMessage(IntPtr hWnd, int Msg, int wp, int lp);

public struct NCHITTEST
{
	public const int Left = 10;
	public const int Right = 11;
	public const int Top = 12;
	public const int TopLeft = 13;
	public const int TopRight = 14;
	public const int Bottom = 15;
	public const int BottomLeft = 16;
	public const int BottomRight = 17;
}

protected override void OnMouseDown(MouseEventArgs e)
{
  	base.OnMouseDown(e);
	if (e.Button == MouseButtons.Left)
    {
    	ReleaseCapture();
      
      	// for the 'wp' parameter, just replace 'BottomRight' with your direction
      	SendMessage(Handle, 161, NCHITTEST.BottomRight, 0);
    }
}
Posted by: Guest on August-13-2020

C# Answers by Framework

Browse Popular Code Answers by Language