I have a picture box which contains an image and some drawn ellipses. while a thread pass by the ellipses increase the alpha of the ellipse but when the tread leaves the ellipse range i can't change the alpha value because it paints it over. how can I erase only the ellipse without touching anything else in the image.
image linksimage1 image2
my code
image linksimage1 image2
my code
Code:
public void work()
{
Graphics xGraph;
xGraph = Graphics.FromImage(pictureBox_Map.Image);
for (int i = 0; i < 5; i++)
{
Thread.Sleep(draw_delay);
double a;
a = Math.Sqrt(Math.Pow(pointcheck[0] - X[i], 2) + Math.Pow(pointcheck[1] - Y[i], 2));
int d = Convert.ToInt32(a);
if (Math.Abs(d) < R[i])
{
if ((elegxos[i] == 0) && (change[i] == false))
{
SolidBrush Brush = new SolidBrush(Color.FromArgb(255, Red[i], Green[i], Blue[i]));
pictureBox_Map.CreateGraphics().FillEllipse(Brush, X[i] - R[i], Y[i] - R[i], R[i], R[i]);
elegxos[i] = 1;
this.Invalidate();
change[i] = true;
}
}
else
{
SolidBrush Brush = new SolidBrush(Color.FromArgb(50, Red[i], Green[i], Blue[i]));
pictureBox_Map.CreateGraphics().FillEllipse(Brush, X[i] - R[i], Y[i] - R[i], R[i], R[i]);
this.Invalidate();
change[i] = false;
}
}
xGraph.Dispose();
this.Invalidate();
}
Comment