panel1里有个控件,如何将里面的控件拖入到panel2中呢?

解决方案 »

  1.   

    全选panel1中控件。拖动控件到panel2中。OK。
      

  2.   

    可以实现效果,但是实际上,不是真的移动到panel2中。
      

  3.   

    在后台HTML中找到panel1的标签然后把整个Panel1的代码辅助到panel2里
      

  4.   

    把panel1拷贝出一个新实例,直接添加到panel2上面,然后清空panel1,不就可以了啊
      

  5.   

    是winform。 要用拖动的操作将它拖过去
      

  6.   

    采用事件方式进行控件的拖动,以下针对Control 定义了三个通用的事件和一个变量。
    使用的时候只需要对需要拖动的控件绑定以下这三个事件就好了,控件就可以自由拖动了
    private Point mouse_offset;
            private void Common_MouseUp(object sender, MouseEventArgs e)
            { 
                if (e.Button == MouseButtons.Left)
                {
                    Point mousePos = Control.MousePosition;
                    mousePos.Offset(mouse_offset.X, mouse_offset.Y);
                    ((Control)sender).Location = ((Control)sender).Parent.PointToClient(mousePos);            }
            }
            private void Common_MouseDown(object sender, MouseEventArgs e)
            {
                mouse_offset = new Point(-e.X, -e.Y);
            }        private void Common_MouseMove(object sender, MouseEventArgs e)
            {
                ((Control)sender).Cursor = Cursors.Arrow;
                if (e.Button == MouseButtons.Left)
                {
                    Point mousePos = Control.MousePosition;
                    mousePos.Offset(mouse_offset.X, mouse_offset.Y);
                    ((Control)sender).Location = ((Control)sender).Parent.PointToClient(mousePos);
                }
            }
    另外的参考