GDI+画图 并在Form窗口拖动的问题
刚学GDI+写了一段程序,在form窗口画个矩形,然后可以拖动.现在拖动是没有问题的.就是拖动的时候不能太快.一旦快了,鼠标就划出矩形区域了.着个问题要怎么解决啊.以下是拖动代码.
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
//是否选中空间
if (this.isSelect == true)
{
if (e.Button == MouseButtons.Left)
{
if (this.Rect.Contains(e.Location))
{
Point point = e.Location;
_mouseEnd = point;
int vix = _mouseEnd.X - _mouseStart.X;
int viy = _mouseEnd.Y - _mouseStart.Y;
int positionX = this.Location1.X + vix;
int positionY = this.Location1.Y + viy;
Point location = new Point(positionX, positionY);
this.Location1 = location;
this.Invalidate(this.Rect);
this.Refresh();
_mouseStart = _mouseEnd;