locked
How to doublebuffer child controls? RRS feed

  • Question

  • 

    I have a panel and I add a group of custom controls (named A) which derived from Control in this panel. In custom control A, I use override OnPaint() to draw some image and text, and add some other custom controls to it.When I use doublebuffer automatically for the panel with SetStyle(),it doesn't affect the child controls. So I use the parameter WS_EX_COMPOSITED for the panel, but the panel renders really slow,(cannot tolerate at all).

    My questions are: 1.Is there a way to achieve doublebuffer manually for a control, which can affect its child controls? Or should I not use class Control to do this kind work? 2.I think there is a performance problem with my custom controls.If I change them to components and only use Onpaint() in them and in their father control, would it be helpful?

    Thursday, September 20, 2012 2:05 AM

Answers

  • Hi,

    if I understood correctly, simply doublebuffering the Child Controls may help:

        public class A : Control
        {
            public ChildControl()
            {
                this.DoubleBuffered = true;
            }
        }

    Regards,

      Thorsten


    Thursday, September 20, 2012 11:40 AM