I have created a program that has multiple panels, and created an array of graphic objects for these panels. I have background images on my panels that are drawn over during mouse click. In about 15 seconds after they are drawn over, the graphics disappear and the background image reappears. I implimented an onpain overide function, but it doesn't seem to stop this behavior. Does anyone know what i'm doing wrong?
Code:
public static void RePaintPlayer(Graphics[] g)
{
for (int x = 1; x <= 4; x++)
{
if (GS.Players[x].CurrentPosition != 0)
{
g[GS.Players[x].CurrentPosition].FillRectangle(new SolidBrush(Color.Blue), 0, 0, 50, 50);
g[GS.Players[x].CurrentPosition].DrawString("Player\n" + x, ArielFont, WhiteColor, new PointF(5, 10));
}
}
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
for (int index = 1; index <= 64; index++)
{
GameUI.CorrectImage(index);
}
GameUI.RePaintPlayer(GameUI.g);
}