本文介绍了启用双重缓冲的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看过以下代码在winform上启用双重缓冲:

I've seen the following code to enable double buffering on a winform:

// Activates double buffering 
this.SetStyle(ControlStyles.DoubleBuffer |
   ControlStyles.OptimizedDoubleBuffer |
   ControlStyles.UserPaint |
   ControlStyles.AllPaintingInWmPaint, true);
this.UpdateStyles();

这与简单地设置Form.DoubleBuffering = true有什么不同吗?

Is this different in any way from simply setting Form.DoubleBuffering = true?

推荐答案

Control.DoubleBuffering执行

SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, value);

因此您的代码也设置了ControlStyles.UserPaint(目前可能无效).

so your code sets ControlStyles.UserPaint as well (which probably has no effect at this point).

这篇关于启用双重缓冲的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 19:14