模拟标题栏,移动或双击可以最大或最小化窗体

来源:互联网 发布:速卖通产品数据分析 编辑:程序博客网 时间:2024/05/01 14:07
internal static int WM_NCHITTEST = 0x84; //移动鼠标,按住或释放鼠标时发生的系统消息
internal static IntPtr HTCLIENT = (IntPtr)0x1;//工作区
internal static IntPtr HTCAPTION = (IntPtr)0x2; //标题栏
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_NCHITTEST)
{
base.WndProc(ref m);
if (m.Result == HTCLIENT)
{
m.Result = HTCAPTION;//模拟标题栏,移动或双击可以最大或最小化窗体
}
}
else
{
base.WndProc(ref m);
}
}
原创粉丝点击