S
schoenfeld1
Why does WinForms in .NET 2 paint container controls more times than
necessary?
Steps to reproduce:
1. Make a UserControl called 'Widget'. Put some buttons / labels / etc
inside this control.
2. Make a UserControl called 'Container'. Place a bunch of 'Widget'
controls inside here.
3. Override the Contaner.OnPaint method and put a breakpoint on
base.OnPaint(e);
4. Start your application but make sure that your app window and IDE
window do not overlap (make IDE window very small and thin for
example). This is to prevent paint calls triggered by overlapping
windows.
5. Observe on the Container.OnPaint method get called after every LEAF
NODE control gets rendered. That means, Container.OnPaint gets called
when the widget gets painted, when the widgets labels/buttons get
painted, etc..
necessary?
Steps to reproduce:
1. Make a UserControl called 'Widget'. Put some buttons / labels / etc
inside this control.
2. Make a UserControl called 'Container'. Place a bunch of 'Widget'
controls inside here.
3. Override the Contaner.OnPaint method and put a breakpoint on
base.OnPaint(e);
4. Start your application but make sure that your app window and IDE
window do not overlap (make IDE window very small and thin for
example). This is to prevent paint calls triggered by overlapping
windows.
5. Observe on the Container.OnPaint method get called after every LEAF
NODE control gets rendered. That means, Container.OnPaint gets called
when the widget gets painted, when the widgets labels/buttons get
painted, etc..