J
james
As part of my app I am programatically adding some Label controls to a form
at runtime. The code for these is part of a function that is overrriding the
Paint event of the form. The other stuff that is drawn in the same function
works fine when I resize the screen (some lines and so on) but the labels
remain.
I tried deleting them by putting the following in the forms' resize event
(the labels are the only "controls" on the form):
for (int c = 0; c < this.Controls.Count; c++)
{
this.Controls.RemoveAt(c);
}
and it sort of works, but I still get some labels left behind - not the
originals but one or two stragglers from when it's resized.
I then tried a putting a "this.refresh()" in there too, but the form just
went into a mad loop when I tried to refresh it and I had to kill the
process
Any suggestions as to where I'm going wrong?
James.
at runtime. The code for these is part of a function that is overrriding the
Paint event of the form. The other stuff that is drawn in the same function
works fine when I resize the screen (some lines and so on) but the labels
remain.
I tried deleting them by putting the following in the forms' resize event
(the labels are the only "controls" on the form):
for (int c = 0; c < this.Controls.Count; c++)
{
this.Controls.RemoveAt(c);
}
and it sort of works, but I still get some labels left behind - not the
originals but one or two stragglers from when it's resized.
I then tried a putting a "this.refresh()" in there too, but the form just
went into a mad loop when I tried to refresh it and I had to kill the
process
Any suggestions as to where I'm going wrong?
James.