I have a problem in a c# code, and wonder if you may help me.
I want to draw an Arc in C# with followin codes:
First one works fine:
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics; Pen pn = new Pen(Color.Blue); Rectangle rect = new Rectangle(50, 50, 200, 100);g.DrawArc(pn, rect, 12, 84);
}
But when I am adding the If statement to the code I cannot see any Arc on the form( there is no error in debugging but there is a problem with showing the results):
public int m=10;
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
if (m == 10){
Graphics g = e.Graphics; Pen pn = new Pen(Color.Blue); Rectangle rect = new Rectangle(50, 50, 200, 100);g.DrawArc(pn, rect, 12, 84);
}
}
AlanPosted Sep 2, 2008, 12:29 PM
Well, the graphics code definitely does work as I tried it myself both with and without the 'if' statement.
However, I'm at a loss to explain why it would not work on your machine when you include the 'if' statment, if 'm' is still 10 and you haven't changed anything else. It simply doesn't make sense :-/
yamidPosted Sep 2, 2008, 5:05 AM
yes, since I was debugging it step by step, .
While debugging, it can draw that but in whole-debugging there is no drawing.
AlanPosted Sep 1, 2008, 1:50 PM