如何启用双缓冲使用C#(窗口的形式)的控制呢? [英] How do i enable double-buffering of a control using C# (Window forms)?

查看:488
本文介绍了如何启用双缓冲使用C#(窗口的形式)的控制呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何启用双缓冲的控件使用C#(窗口的形式)?

How do i enable double-buffering of a control using C# (Window forms)?

我有一个panelcontrol对此我画的东西进入,也是一个所有者绘制TabControl的。从闪烁两种痛苦,所以如何启用双缓冲?

I have a panelcontrol which i am drawing stuff into and also an owner drawn tabcontrol. Both suffer from flicker, so how to 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#(窗口的形式)的控制呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆