First off, I'm a real beginer at C# so please be gentle.
I'm trying to have a circle follow my cursor. I don't want any "trails" to be left behind.
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
drawCircle(e.X, e.Y);
}
private void drawCircle(int x, int y)
{
Pen skyBluePen = new Pen(Brushes.DeepSkyBlue);
Graphics graphics = CreateGraphics();
graphics.DrawEllipse(
skyBluePen, x - 150, y - 150, 300, 300);
graphics.Dispose();
this.Invalidate();
}
This works ok, as it draws it and centers on the mouse for every mouse move. However, the "this.Invalidate();" is wrong. It "undraws" the shape after every movement, so I can only see glimpses of it. However, not including it causes every single drawn circle to remain on screen.
How do I get one circle to "gracefully" follow my mouse around, without being too jumpy and without retaining all of the past circles?