I can create forms in code OK but if I draw graphics on them they don't refresh automatically. If they are resized or another form is displayed over them then the graphics are wiped out. If I could put the code in the form's paint method I know it would refresh automatically but I can't access the paint method because the sub form_paint() doesn't exist. Is there some other way of making a form created in code repaint

Create forms in code but can't 'paint' them
Lalaa
Okay, you said that form_paint() does not exist. I don't understand this. You can override the OnPaint method, as I have done below. My rectangle is never wiped out.
protected
override void OnPaint(PaintEventArgs e){
Graphics g = e.Graphics;g.DrawRectangle(
new Pen(new SolidBrush(Color.Red)), new Rectangle(20, 20, 40, 40));}
Primillo
beelzeboris
form_paint does not exist because I have created the form in code.
For instance, here I create five forms. I can then draw on the forms but if I move one form on top of another anything I have drawn gets wiped out.
For
i = 1To 5 Dim inst As New graphicsForminst.name =
"Window" & Str$(i)inst.form =
New FormgraphicsForms.Add(inst,
CStr(i)) Next iXanthius
You can use the Invalidate() method. This will cause a redraw.
Regards,
Deepak