请问怎么在Button事件里实现让这个Form窗体在鼠标左键尝试拖拽时让窗体不移动!

解决方案 »

  1.   

    从SystemMenu中把“移动”菜单项移除即可。
      

  2.   

    从SystemMenu中把“移动”菜单项移除即可。
      

  3.   

     // ERROR: Not supported in C#: DeclareDeclaration
     // ERROR: Not supported in C#: DeclareDeclaration
    public const int SC_MOVE = 61456;
    public const int MF_BYCOMMAND = 0;
    public const int MF_DISABLED = 2;public const int MF_GRAYED = 1;
    private void Form1_Load(System.Object sender, System.EventArgs e)
    {
    Form f = new Form();
    f.TopLevel = false;
    f.Parent = Panel1;
    f.Show();
    IntPtr hMenu = GetSystemMenu(f.Handle, 0);
    RemoveMenu(hMenu, SC_MOVE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
    }
      

  4.   

    参考
    http://topic.csdn.net/u/20100910/18/134e2442-d34a-4cad-9fd9-e8e79ef185b7.html
    代码转换工具
    http://www.developerfusion.com/tools/convert/vb-to-csharp/
      

  5.   

    复制粘贴代码到你按钮的Clicked事件不就行了。