i need to draw a line for example, in a dynamically created PictureBox
. What happens is that the picture box is created and shown in the form but the line is missing. My code is below, any ideas?? thnx
public void create_pb()
{
PictureBox pb = new PictureBox();
pb.Size = new Size(200, 200);
pb.BorderStyle = BorderStyle.Fixed3D;
pb.Location = new Point(0,0);
panel1.Controls.Add(pb);
g = pb.CreateGraphics();
Pen p = new Pen(Color.Black, 2);
g.DrawLine(p, 0, 0, 200, 200);
}
g
is defined as public Graphics g;