I have written a UserControl that behaves like a ContainerControl, but is totally painted by WindowsForms (I inherit from UserControl
)
I would like to avoid painting the control while I'm filling it, so I would need to write something similar to BeginUpdate()
- EndUpdate()
.
This is easy to do when the control is user-painted, but in this case I'm not sure about how to proceed.
You could make use of Suspend/Resume layout. e.g.
private void BeginUpdate()
{
this.SuspendLayout();
// Do paint events
EndUpdate();
}
private void EndUpdate()
{
this.ResumeLayout();
// Raise an event if needed.
}
If you're interested in suspending the painting of a control and it's children, check out this SO question: Suspend Control and Children Painting
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With