Reputation: 8498
Is it possible to repaint the form for only one control. That is I need to increase the width of a label. but while repainting the form, the form totally refreshing. that looks like the form is blinking. So I need to redraw the label only. Please help me
Upvotes: 2
Views: 3090
Reputation: 1250
Instead of Repaint (which is slow indeed) I recommend using this pair of lines to refresh a control:
myControl.Visible = False
myControl.Visible = True
It is much faster. Invisible state is so short that it behaves very smoothly.
It also works for me where DoEvents doesn't. E.g. in a class that has WithEvents attribute to handle control's events and change its appearence. Hope it helps!
Upvotes: 2
Reputation: 8498
Instead of formName.Repaint I tried with "DoEvents". It worked for me.
formCreateAndValidate.lblPgrsBar.Width = prgrsLblWidth
DoEvents
Upvotes: 3