我把windowsstate设为最大化,MaximizeBox设为false启动后界面可以被拖动
而且状态栏把任务栏也遮住了而且双击form标题栏,也会让form变小

解决方案 »

  1.   

    http://www.cnblogs.com/skyiv/archive/2005/10/05/WndProc.html
      

  2.   

    FormBorderStyle = FormBorderStyle.FixedSingle
      

  3.   

    // 用API去掉系统菜单的“移动”菜单项using System; 
    using System.Windows.Forms; 
    using System.Runtime.InteropServices; class Test : Form 

      const int MF_BYPOSITION = 0x0400; 
      const int MF_REMOVE     = 0x1000;   [DllImport("user32.dll",EntryPoint="GetSystemMenu")] 
      extern static IntPtr GetSystemMenu(IntPtr hWnd, IntPtr bRevert);   [DllImport("user32.dll",EntryPoint="RemoveMenu")] 
      extern static int RemoveMenu(IntPtr hMenu, int nPos, int flags);   Test() 
      { 
        Text            =  "不能移动和改变大小的窗口"; 
        FormBorderStyle = FormBorderStyle.FixedSingle; 
        MaximizeBox     = false; 
        MinimizeBox     = false; 
        RemoveMenu(GetSystemMenu(Handle,IntPtr.Zero),1,MF_BYPOSITION|MF_REMOVE); 
      }   static void Main() 
      { 
        Application.Run(new Test()); 
      } 

      

  4.   

    http://www.cnblogs.com/skyiv/archive/2005/10/05/WndProc.html
      

  5.   

    FormBorderStyle = FormBorderStyle.FixedSingle
    ---------------
    这个没有用,你可以试试
    只不过保证你不能够拖动变大变小
      

  6.   

    如果你是winform程序的话,可以这么做,controlbox设置为false没有系统功能按钮。把窗体的fomrborderstyle设置为FixedSingle\Fixed3D都行然后把maximizebox设置为false这样鼠标就不能拖拽你的窗体了  this.WindowState = FormWindowState.Maximized;设置最大
      

  7.   

    this.WindowState = FormWindowState.Maximized;
    this.FormBorderStyle = FormBorderStyle.FixedSingle;
    this.MinimizeBox = false;
      

  8.   

    controlbox设置为false,标题栏就没有图标了阿
      

  9.   

    haha 
    要用得是
    FormBorderStyle = FormBorderStyle.None;
      

  10.   

    // 用API去掉系统菜单的“移动”菜单项using System; 
    using System.Windows.Forms; 
    using System.Runtime.InteropServices; class Test : Form 

      const int MF_BYPOSITION = 0x0400; 
      const int MF_REMOVE     = 0x1000;   [DllImport("user32.dll",EntryPoint="GetSystemMenu")] 
      extern static IntPtr GetSystemMenu(IntPtr hWnd, IntPtr bRevert);   [DllImport("user32.dll",EntryPoint="RemoveMenu")] 
      extern static int RemoveMenu(IntPtr hMenu, int nPos, int flags);   Test() 
      { 
        Text            =  "不能移动和改变大小的窗口"; 
        WindowState     = FormWindowState.Maximized;
        FormBorderStyle = FormBorderStyle.FixedSingle; 
        MaximizeBox     = false; 
        MinimizeBox     = false; 
        RemoveMenu(GetSystemMenu(Handle,IntPtr.Zero),1,MF_BYPOSITION|MF_REMOVE); 
      }   static void Main() 
      { 
        Application.Run(new Test()); 
      } 

      

  11.   

    如果你是winform程序的话,可以这么做,controlbox设置为false没有系统功能按钮。把窗体的fomrborderstyle设置为FixedSingle\Fixed3D都行然后把maximizebox设置为false这样鼠标就不能拖拽你的窗体了  this.WindowState = FormWindowState.Maximized;设置最大
    ---------------------
    这样不行
    我现在需要有个最小化的按钮form一启动,就是最大化,可以最小化,但是不能拖动,双击不能够变小
      

  12.   

    那就把    MinimizeBox     = false; 去掉。
      

  13.   

    protected override void WndProc(ref Message m)
    15  {
    16    base.WndProc(ref m);
    17    if(m.Msg == 0x84 && m.Result == (IntPtr)2) // 不让拖动标题栏
    18    {
    19      m.Result = (IntPtr)1;
    20    }
    21    if (m.Msg == 0xA3)                         // 双击标题栏无反应
    22    {
    23      m.WParam = System.IntPtr.Zero;
    24    }
    25  }
    用这个就可以了
    下面这段不要也可以啊,
    if (m.Msg == 0xA3)                         // 双击标题栏无反应
        {
          m.WParam = System.IntPtr.Zero;
        }
      

  14.   

    但是有个问题,form的状态栏把任务栏给遮住了,该怎么解决阿
      

  15.   

    任务栏 -> 右键 -> 属性 -> 勾上“总在最前” -> 去掉“自动隐藏”。
      

  16.   

    你没有明白意思,我任务栏不是自动隐藏的
    form一启动就把任务栏遮住了
      

  17.   

    你可以试试,
    把maximizebox设置为false
    WindowState = FormWindowState.Maximized;设置最大form一启动就会把任务栏遮住
      

  18.   

    确实,同时指定WindowState = FormWindowState.Maximized;
    MaximizeBox = false;将会使form一启动就把任务栏遮住。
    ----------------------------------------------
    WindowState = FormWindowState.Maximized;
    MaximizeBox = true; 则不会遮住任务栏,可能是M$的一个Bug。