大哥大姐们帮我教一下,C# 中使无标题窗口用鼠标点任意位置实现移动,但是双击会最大化,谁知道怎么屏蔽?
protected override void WndProc(ref Message m){
const int WM_NCHITTEST = 0x84;
const int HTCLIENT = 0x01;
const int HTCAPTION = 0x02;
const int WM_SYSCOMMAND = 0x0112;
const int SC_MAXMIZE = 0xF030;
switch (m.Msg)
{
case WM_NCHITTEST:
this.DefWndProc(ref m);
if (m.Result.ToInt32() == HTCLIENT)
m.Result = new IntPtr(HTCAPTION);
break;
case WM_SYSCOMMAND:
if (m.WParam.ToInt32() == SC_MAXMIZE)
MessageBox.Show("");
break;
default:
base.WndProc(ref m);
break;
}
}
第一个case是实现用鼠标点任意位置移动窗体
为什么加了第二个case以后就不能任意位置移动窗体了呢,
麻烦行家指点下