this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.UserPaint, true);
注释:避免绘图闪烁问题
同理:
this.SetStyle(ControlStyles.OptimizedDoubleBuffer
| ControlStyles.ResizeRedraw
| ControlStyles.Selectable
| ControlStyles.AllPaintingInWmPaint
| ControlStyles.UserPaint
| ControlStyles.SupportsTransparentBackColor,
true);
或:
this.SetStyle(ControlStyles.UserPaint, true);//自绘
this.SetStyle(ControlStyles.DoubleBuffer, true);// 双缓冲
this.SetStyle(ControlStyles.ResizeRedraw, true); //调整大小时重绘
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); //禁止檫除背景
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); //双缓冲
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); //透明效果