c# - Lines not drawing to picture box every time -
when code runs 1/3 of time draw properly, rest not draw of 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();
not enough information sure, however, first make sure variable 'noofguesses' value between 1-7, value of 0 or 8 end doing nothing. second, add 'default' case in case 'noofguesses' out of range reason , have draw line.
Comments
Post a Comment