您的位置:首页 > 其它

WinForm中禁止窗体移动

2012-10-16 17:32 337 查看
设置窗体出现的具体位置:

窗体 form = new 窗体();
form.StartPosition = FormStartPosition.Manual;
form.Location = new Point(300, 0);
form.Show();


禁止窗体自由移动:

public const int WM_SYSCOMMAND = 0x112;
public const int SC_MOVE = 0xF012;

protected override void WndProc(ref   Message m)
{
if (m.Msg == WM_SYSCOMMAND)
{
if ((int)m.WParam == SC_MOVE)
return;
}
base.WndProc(ref   m);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: