我想用C#画点.然后鼠标移动事件里面画.但是画出来效果不行!鼠标移动快了点就分开了.而不是连接成一个线!!哪个大哥能帮忙解决下??

解决方案 »

  1.   

    MouseMove的事件里面画上一个点的位置到当前鼠标点的线段,并在上一个点和当前鼠标点的位置画一个圆,用线条的颜色进行填充,然后记录当前位置为上一个点。说得比较绕,不过意思还是很简单的
      

  2.   

    Point opt = Point.Empty;
    private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
    {
    Graphics g= this.CreateGraphics();
    Point npt = new Point(e.X, e.Y);
    if (opt.IsEmpty) opt = npt;
    Pen p = new Pen(System.Drawing.Color.Red);
    p.Width = 1;
    g.DrawLine(p, opt, npt);
    opt = npt;
    }
      

  3.   

    这个跟ms的系统设计有关系吧。除非你移动的慢一些,画的点大一些。否则没有解决方案。
    参考代码:
    Point opt = Point.Empty; 
    private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) 

       Graphics g= this.CreateGraphics(); 
       Point npt = new Point(e.X, e.Y); 
       if (opt.IsEmpty) opt = npt; 
       Pen p = new Pen(System.Drawing.Color.Red); 
       p.Width = 1; 
       g.DrawLine(p, opt, npt); 
       opt = npt; 
    }