Problem solving drawing blinking (C #)

          In the course of recent development projects, we found the system it often happens that the splash screen, and double buffering is enabled can effectively solve this problem.

Meanwhile, in order to facilitate references we have developed a dual cache Panel control. In fact, to enable double-buffering is very simple, just a constructor in the control or form

3 was added the following lines of code. Extend other controls as well. Abstracts on double buffering, see Introduction reprinted last

Problem solving drawing blinking (C #) have introduced.


     public class PanelEx:Panel
    {
        public PanelEx()
        {
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);   //   禁止擦除背景.
            SetStyle(ControlStyles.DoubleBuffer, true);   
        }
    }


Reproduced in: https: //www.cnblogs.com/kevinGao/archive/2011/11/01/2231517.html

Guess you like

Origin blog.csdn.net/weixin_34290631/article/details/93361706