自己重写了一个控件,使用的时候发现图片的闪烁的时候太快,大家有什么方法可以消除吗?
以下是该控件的类,以及该类的构造函数,谢谢!
        里面有一个方法
  DoubleBuffered = true; 是属于双缓存,很多人说要双缓存,确实我也写了双缓存.
class TableSizeControl : Control
{
 public TableSizeControl()
        {
            DoubleBuffered = true;
            components = new System.ComponentModel.Container();
            imageList1 = new System.Windows.Forms.ImageList(components);
                      imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
            imageList1.ImageSize = new System.Drawing.Size(16, 16);
            imageList1.TransparentColor = System.Drawing.Color.Transparent;
            for (int i = 0; i < 96; i++)
                imageList1.Images.Add(System.Drawing.Image.FromStream(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("CodeProject.Resources." + i.ToString() + ".gif")));
            //DoubleBuffered = true;            
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            
            SetStyle(ControlStyles.DoubleBuffer, true);
            SetStyle(ControlStyles.UserMouse, true);            SetStyle(ControlStyles.ResizeRedraw,true); // 只要鼠标有移动,就开始发生事件,而这里是如果为 true,则在调整控件大小时重绘控件
            UpdateLayout();            //this.Paint+=()
        }
}