Controls flickering due to background image of panel


  • Hello,

    I have developed a windows application whose interface has multiple picture boxes panels with background images for rich look and also a usercontrol which contains a gridview and WPF scrollbar in an element host. All these controls are placed in one panel (this is also having a background image) which is equal to the size of windows form. The reason for placing all these controls in the panel is that the window can be resized, if needed, allowing scrollbars.

    Due to these large number of controls in which some of them have transparent backgrounds loaded in a large panel having background image, the window is flickering when moved or any other application's window is moved over it.

    I need suggestions regarding the ways to minimize this flickering.

    Thanks in advance,


    Surya Praveen

    Thursday, March 01, 2012 10:03 AM


  • Hi Surya,
    So, turning on WS_EX_COMPOSITED will solve this issue but making the scrollbar unvisible, am I right?
    Well, I think you might try custom drawing TrackBar instead of scrollbar.
    WS_CLIPCHILDREN is similar to WS_EX_COMPOSITED, just overwriting CreateParams.
    You can find more details in this link,
    Best Regards,

    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Surya Praveen Wednesday, March 07, 2012 10:33 AM
    Tuesday, March 06, 2012 9:50 AM
  • Hi Bob,

    Turning off the window's style WS_CLIPCHILDREN worked extremely great!!! This removed ugly patches left over by child controls.

    I thank you so much for providing all available links on this issue!!!

    Thanks to nobugz for his clear and detailed suggestions in the link One more suggestion that worked well suggested in the link  is using background images of exact control's size and using pixel format Format32bppPArgb.

    I am still using WPF controls - scrollbars and textboxes which are still flickering but at an ignorable level (I don't think we can stylize a track bar as flexible as WPF scrollbar). I feel that the extended style WS_EX_COMPOSITED is not all a good solution when using WPF controls. Even if WPF controls are not present, this style takes lot of CPU's cost and black patches are visible around borders.

    I just want to list out solutions that fixed flickering issues in my application:

    1. Using a custom panel on which double buffering is enabled and WS_CLIPCHILDREN is turned off

    2. Setting DoubleBuffered property to True on windows form and all user controls (Do not turn off WS_CLIPCHILDREN if WPF control is present in user control, this makes redraw problems of WPF control)

    3. Using background images of exact sizes (by writing a method for shrinking image) for controls and using pixel format  "Format32bppPArgb".

    Surya Praveen

    Wednesday, March 07, 2012 5:08 AM

All replies