日期:2014-05-17 浏览次数:21228 次
for (int i = 1; i < arr.Count; i++)
g.DrawLine(Pens.Red, (Point)arr[i - 1], ((Point)arr[i]));
public partial class Form1 : Form
{
IList<Point> arr;
public Form1()
{
InitializeComponent();
DoubleBuffered = true;
arr = new List<Point>();
}
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
arr.Add(new Point(e.X, e.Y));
this.Invalidate();
}
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (arr.Count == 1)
{
e.Graphics.Fi