直接更改Picture的Location即可

解决方案 »

  1.   

    给你个参考:
    以下的代码画出了一个矩形,可以使用鼠标来拖动这个矩形.
    public partial class MoveRect : Form
    {
    private Rectangle m_Rect;
    private Point m_LastMSPoint;
    public MoveRect()
    {
    InitializeComponent();
    this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true);
    m_Rect = new Rectangle(10, 10, 50, 30);
    }
    protected override void OnPaint(PaintEventArgs e)
    {
    base.OnPaint(e);
    e.Graphics.FillRectangle(SystemBrushes.ControlDark, this.m_Rect);
    e.Graphics.DrawRectangle(SystemPens.ControlDarkDark, this.m_Rect);
    }
    protected override void OnMouseDown(MouseEventArgs e)
    {
    base.OnMouseDown(e);
    this.m_LastMSPoint = e.Location;
    }
    protected override void OnMouseMove(MouseEventArgs e)
    {
    base.OnMouseMove(e);
    if (e.Button != MouseButtons.Left)
    {
    return;
    }
    this.m_Rect.Offset(e.Location.X - this.m_LastMSPoint.X, e.Location.Y - this.m_LastMSPoint.Y);
    //绘制新的图形
    this.Invalidate();
    this.m_LastMSPoint = e.Location;
    }
    }