I have a custom control containing a mixture of custom and standard controls. When the control is made larger, I’m getting background coloured rectangles where the child control will be painted, before the paint of the child control completes. It’s the same for both my custom controls and the standard ones.
I thought that suspend layout was the way to avoid this, but it isn’t working for me.
I suspend layout for the container and all its controls while the resizing takes place.
Do I need to override the paint method for the child controls? Surely that would mean new custom controls to replace all the standard ones, or do I need to override the paint method for the container?
EDITED to correct information and reference
One approach is to double buffer. People often set this style and assume it is working but you may not in fact get double buffering for various reasons. But true double buffering can have some negative consequences too.
The following solution provide by Hans Passant will typically fix this sort of problem without causing some of the side effects of double buffering.
label backgrond flicking on a WinForms user control has background image enabled
By removing the WS_CLIPCHILDREN attribute the spaces the controls are supposed to occupy will be filled with background first which can reduce the artifacts you see waiting for the controls to be drawn
Add the following code to your custom control: