如何锁定MDI子窗体的位置,为什么用Location=new Point(0,0)不起作用?
请问有什么好的方法?

解决方案 »

  1.   

    需要把StartPosition设置为Manual即可...
      

  2.   

    要想让窗体显示后不可移动(锁定位置)可以参考下代码来操作(用API):[DllImport("User32.dll")]
    public static extern int GetSystemMenu(int hWnd, int bRevert);
    [DllImport("User32.dll")]
    public static extern int RemoveMenu(int hMenu, int nPosition, int wFlags);public const int MF_BYCOMMAND = 0x00000000;
    public const int MF_DISABLED = 0x00000002;
    public const int MF_GRAYED = 0x00000001;
    public const int SC_MOVE = 0xf010;protected override void OnLoad(EventArgs e)
    {
    int hMenu;
    hMenu = GetSystemMenu(this.Handle.ToInt32(), 0);
    //移动菜单
    RemoveMenu(hMenu, SC_MOVE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);   
    }
      

  3.   

    hbxtlhx方法好。我最近也才发现这个方法的。不过是vc下用的。这样是比较完美的禁止移动的方法了。