This bothers me a lot of days, few scores in all
CodePudding user response:
The complete code: https://download.csdn.net/download/caozhy/12082528Problem solving, please stick to points
using System;
using System.Collections.Generic;
Using System.Com ponentModel;
Using System. The Data;
Using System. Drawing;
using System.Linq;
Using System. The Text;
Using System. Windows. Forms;
The namespace T395559890
{
Public partial class Form1: Form
{
Public _click ()
{
InitializeComponent();
Enclosing DoubleBuffered=true;
}
Private ListLines=new List (a);
Private Point? The pre.
Private void Form1_Paint (object sender, PaintEventArgs e)
{
The foreach (var item in lines)
{
Um participant raphics. DrawLine (Pens. Black, item. The Item1, item. The Item2);
}
}
Private void Form1_MouseMove (object sender, MouseEventArgs e)
{
If (e.B utton==System. Windows. Forms. MouseButtons. Left)
{
If (pre. HasValue)
{
Lines. The Add (new Tuple(pre) Value, new Point (e.X, e.Y)));
The Refresh ();
}
The pre=new Point (e.X, e.Y);
}
The else
{
If (pre. HasValue)
{
Lines. The Add (new Tuple(pre) Value, new Point (e.X, e.Y)));
The Refresh ();
}
The pre=null;
}
}
}
}