我已在MouseDown和MouseMove事件中添加了相应的方式实现了窗口拖动,但是如果窗口中有其它组件,如label、picturebix,则鼠标在此控件上移动时无法拖动窗口,不知没有没应对方法。

解决方案 »

  1.   

    [DllImportAttribute ("user32.dll")]
    public static extern int SendMessage(IntPtr hWnd, 
    int Msg, int wParam, int lParam);

    [DllImportAttribute ("user32.dll")]
    public static extern bool ReleaseCapture();
      

  2.   

    f (e.Button == MouseButtons.Left)//移动图片
    {
    ReleaseCapture();
    SendMessage(this.m_picBox.Handle , WM_NCLBUTTONDOWN, HT_CAPTION, 0);
    }
      

  3.   

    using System.Reflection;
    using System.Runtime.InteropServices;
      

  4.   

    能不能详细点,看不懂什么意思。我的要求是拖动窗口。在窗口内的其它控件上如label也能引发窗口的mouse_down,mouse_move事件。
      

  5.   

    放在一个  panel上面拖动panel就可以了
    panel mouse_down 上面是API实现的
      

  6.   

    f (e.Button == MouseButtons.Left)//移动图片
    {
    ReleaseCapture();
    SendMessage(this.panel.Handle , WM_NCLBUTTONDOWN, HT_CAPTION, 0);
    }
      

  7.   

    这两个值是什么:WM_NCLBUTTONDOWN, HT_CAPTION