raulredondo(),我这个是画mouse轨迹的,就是以下: Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove 'THIS routine does draw an expanding dashed rectangle correctly
If startDrawing = 1 Then newpt = New Point(e.X, e.Y) PictureBox1.CreateGraphics.DrawLine(New Pen(Color.Black, 1), oldpt, newpt) oldpt = newpt ok = 0 End If End Sub
在MouseMove事件里面记录每一个点的位置,存储在一个数组里面,然后在Paint事件里面根据每一个点的位置重新画一遍。 PictureBox1_MouseMove() { Points[i] = new Point(e.X, E.y); i++; }PictureBox1_Paint() { for(int i = 0; i < Max; i++) PictureBox1.CreateGraphics.DrawLine(New Pen(Color.Black, 1), Points[i], Points[i+1]); }
Me.pictureBox1.CreateGraphics().Save
'THIS routine does draw an expanding dashed rectangle correctly
If startDrawing = 1 Then newpt = New Point(e.X, e.Y) PictureBox1.CreateGraphics.DrawLine(New Pen(Color.Black, 1), oldpt, newpt) oldpt = newpt
ok = 0
End If
End Sub
PictureBox1_MouseMove()
{
Points[i] = new Point(e.X, E.y);
i++;
}PictureBox1_Paint()
{
for(int i = 0; i < Max; i++)
PictureBox1.CreateGraphics.DrawLine(New Pen(Color.Black, 1), Points[i], Points[i+1]);
}
用路径,区域来存取你画的线什么的