[英]How do I enable double-buffering of a control using C# (Windows forms)?
如何使用C#(Windows窗體)啟用控件的雙緩沖?
我有一個面板控件,我正在繪制內容,也是一個所有者繪制的選項卡控件。 兩者都有閃爍,所以如何啟用雙緩沖?
在控件的構造函數中,適當地設置DoubleBuffered屬性和/或ControlStyle。
例如,我有一個簡單的DoubleBufferedPanel,其構造函數如下:
this.DoubleBuffered = true;
this.SetStyle(ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint |
ControlStyles.ResizeRedraw |
ControlStyles.ContainerControl |
ControlStyles.OptimizedDoubleBuffer |
ControlStyles.SupportsTransparentBackColor
, true);
一些信息:
使用繼承自System.Windows.Forms.Control的DoubleBuffered屬性。
System.Windows.Forms.Form myForm = new System.Windows.forms.Form();
myForm.DoubleBuffered = true;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.