private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
if (touchPoint != -1 && touch)
{
e.Graphics.DrawEllipse(penPoints, list[touchPoint].X - 5, list[touchPoint].Y - 5, 10, 10);
}
}
private void pictureBox_mouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
for (int i = 0; i < list.Count; i++)
{
if ((e.X - list[i].X) * (e.X - list[i].X) + (e.Y - list[i].Y) * (e.Y - list[i].Y) <= 400f)
{
touchPoint = i;
touch = true;
break;
}
}
if (!touch)
{
list.Add(new Point(e.X, e.Y));
}
}
pictureBox1.Invalidate();
}
private void pictureBox_mouseMove(object sendre, MouseEventArgs e)
{
if (touch)
{
list[touchPoint] = new Point(e.X, e.Y);
pictureBox1.Invalidate();
}
}
private void pictureBox_mouseUp(object sender, MouseEventArgs e)
{
if (touch)
{
list[touchPoint] = new Point(e.X, e.Y);
touch = false;
}
}