When my code runs only about 1/3 of the time it will actually draw properly, the rest it will just not draw some of the lines.
Pen pen = new Pen(Color.Black);
Graphics graphics = MainFrm.HangmanImage.CreateGraphics();
switch (NoOfGuesses)
{
case 1://Bottom left leg
graphics.DrawLine(pen, 15, 60, 40, 60);
break;
case 2://Bottom right leg
graphics.DrawLine(pen, 40, 60, 55, 60);
break;
case 3://Middle stock
graphics.DrawLine(pen, 34, 20, 34, 60);
break;
case 4: //Top line
graphics.DrawLine(pen, 34, 20, 55, 20);
break;
case 5: //Rope
graphics.DrawLine(pen, 55, 20, 55, 25);
break;
case 6: //Head
graphics.DrawEllipse(pen, (new Rectangle { X=52, Y=25, Height=5, Width=5 }));
break;
case 7: //Body
graphics.DrawLine(pen, 55, 30, 55, 35);
break;
}
pen.Dispose();
graphics.Dispose();