fj fj

fj fj

  • NA
  • 6
  • 0

Problem with Paint on a form

Nov 23 2005 1:06 PM

Hi there.

I am having a bit of a problem with Paint. I have a form and then when a user selects a certain choice from a menu the program puts several label controls with a text on the form. The program is also supposed to draw some lines when the same selection is made but it does not. Let me show you a little what I am talking about:

private void dowhatIwant(object sender, EventArgs e)

                   {                 

                  

                             this.Paint += new PaintEventHandler(p2_Paint);

...

...  //here is the code that puts the labels on the form

}

...

...

private void p2_Paint(object sender, PaintEventArgs e)

                   {

                             Graphics g = e.Graphics;

                             Pen p = new Pen(Color.Black,1);

                             Point p1 = new Point(88, 32);

                             Point p2 = new Point(299, 32);

                             g.DrawLine(p, p1, p2);

                             Point p3 = new Point(68, 106);

                             Point p4 = new Point(115, 106);

                             g.DrawLine(p, p3, p4);

...

...

}

I have several more lines I want to draw but only the first one shows partially. Can someone please show me the error of my ways?

Thank you,