转自:http://blog.csdn.net/commandos/article/details/1904558
case Win32.WM_NCACTIVATE:
if (m.WParam == (IntPtr)Win32.WM_FALSE)
{
m.Result = (IntPtr)Win32.WM_TRUE;
}
return;
if (m.WParam == (IntPtr)Win32.WM_FALSE)
{
m.Result = (IntPtr)Win32.WM_TRUE;
}
return;
WM_NCACTIVATE消息。
base.WndProc(ref m)负责画窗体被激活或者没有被激活时的样子,
自己重画窗体非客户区域之后,就不能再调用base.WndProc(ref m)了。否则窗体又会被重新画成原来的样子。
一开始使用
case Win32.WM_NCACTIVATE:
return;
return;
问题来了。发现这个窗体成了“霸王”窗口,没法激活其他的窗体了。
原因就在这个消息的返回值上。
if (m.WParam == (IntPtr)Win32.WM_FALSE)
{
m.Result = (IntPtr)Win32.WM_TRUE;
}
{
m.Result = (IntPtr)Win32.WM_TRUE;
}
当WM_NCACTIVATE消息的wParam参数为true 时表示窗体被激活,为false 时表示窗体改为未被激活的状态,这个时候。消息的返回值。为true 表示允许激活它的窗体,为false 表示不允许激活其他的窗体