本文介绍了如何启用使用C#(Windows窗体)控制的双缓冲?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何启用的控制使用C#双缓冲(Windows窗体)?
How do I enable double-buffering of a control using C# (Windows forms)?
我有我画的东西变成面板控制,也是一个所有者绘制的标签控件。从闪烁两者受苦,所以我怎么能实现双缓冲?
I have a panel control which I am drawing stuff into and also an owner-drawn tab control. Both suffer from flicker, so how can I enable double-buffering?
推荐答案
在你的控制构造,设置DoubleBuffered财产和/或ControlStyle适当。
In the constructor of your control, set the DoubleBuffered property, and/or ControlStyle appropriately.
例如,我有一个简单DoubleBufferedPanel它的构造如下:
For example, I have a simple DoubleBufferedPanel whose constructor is the following:
this.DoubleBuffered = true;
this.SetStyle(ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint |
ControlStyles.ResizeRedraw |
ControlStyles.ContainerControl |
ControlStyles.OptimizedDoubleBuffer |
ControlStyles.SupportsTransparentBackColor
, true);
这篇关于如何启用使用C#(Windows窗体)控制的双缓冲?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!