网上找了好几个,都不行,鼠标进入点不点不管用,如果像在编辑状态下那样处理就足够了!如何做到呢?

解决方案 »

  1.   


    public class MyPanel : Panel
    {
        [System.Runtime.InteropServices.DllImport("user32.dll")]
        private static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wparam, int lparam);
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            if (e.Button == MouseButtons.Left)//按下的是鼠标左键   
            {
                Capture = false;//释放鼠标,使能够手动操作   
                SendMessage(this.Handle, 0x00A1, 2, 0);//拖动窗体   
            }
        }}复制到你项目任何一个地方,编译一次,在工具栏拖这个MyPanel到窗体上。就可以运行的时候随意拖动了。
    本方法来自我博客:
    http://blog.csdn.net/wuyazhe/archive/2010/06/23/5690116.aspx
      

  2.   

    一楼的回答,如果单一个PANEL的确可以拖动,但我在里边加了一个WEBBROWSER,就无法拖动了!不知楼主有没有好办法,另外如何缩放呢?