您的位置:首页 > 其它

Winform 防止双击标题栏改变窗体大小 、移动窗体

2012-09-18 10:11 387 查看
c#代码

protected override void WndProc(ref Message m)
{
//拦截双击标题栏、移动窗体的系统消息
if (m.Msg != 0xA3 && m.Msg != 0x0003 && m.WParam != (IntPtr)0xF012)
{
base.WndProc(ref m);
}
}


vb代码

Protected Overrides Sub WndProc(ByRef m As Message)

'拦截双击标题栏、移动窗体的系统消息
If m.Msg <> Convert.ToInt32("0xA3", 16) And m.Msg <> Convert.ToInt32("0x0003", 16) And m.WParam <> CType(Convert.ToInt32("0xF012", 16), IntPtr) Then
MyBase.WndProc(m)
End If

End Sub


说明:

拦截双击标题栏的系统信息:m.Msg<>0xA3

拦截移动窗体的系统消息:m.Msg<> 0x0003 && m.WParam = (IntPtr)0xF012
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: