protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
switch (m.Msg)
{
case 0xA1://WM_NCLBUTTONDOWN
case 0x84://WM_NCHITTEST
if (MouseButtons == MouseButtons.Left)//
{
var mousePoint = new Point((int)m.LParam);// ( )
//NClientClick(mousePoint); //
}
break;
}
}
private Rectangle ScreenRectangle //
{
get
{
var r = new RECT();
GetWindowRect(new HandleRef(this, Handle), ref r);
var clientRect = new Rectangle(r.Left, r.Top, r.Right - r.Left, r.Bottom - r.Top);
return clientRect;
}
}
[DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]
public static extern bool GetWindowRect(HandleRef hWnd, [In, Out] ref RECT rect);
public struct RECT
{
///
public int Left;
///
public int Top;
///
public int Right;
///
public int Bottom;
}