为什么默认情况下禁用DoubleBuffered? [英] Why is DoubleBuffered disabled by default?

查看:1847
本文介绍了为什么默认情况下禁用DoubleBuffered?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建新表单后,我通常会执行此项仪式:

After creating a new form, I usually perform this ritual:


  1. 将名称更改为有意义的内容;

  2. 键入 Caption ;

  3. 更改position属性(DefaultPosOnly几乎不会有什么用户期望);

  4. ShowHint 设置为 true ;

  5. DoubleBuffered 设置为 true ;

  1. Change the name into something meaningful;
  2. Type a Caption;
  3. Change the position property (DefaultPosOnly is hardly ever what users expect);
  4. Set ShowHint to true;
  5. Set DoubleBuffered to true;

我一直在想,为什么默认值为False。对我来说,它只是看起来低科技和肮脏,在我的新机器上,我没有注意到任何性能差异。

I've been wondering for a while why the default value is 'False'. To me it just looks low-tech and crappy, and on my new machine I don't notice any difference in performance.

在旧机器上,双核缓冲存在问题,VNC,远程桌面或虚拟机可能吗?

Is doublebuffering problematic on older machines, VNC, Remote Desktop or in Virtual Machines maybe?

您是否打开或关闭?任何建议?

Do you leave it on or off? Any recommendations?

推荐答案

您可能知道,双缓冲区通常涉及创建与屏幕内存缓冲区相同的大小视觉成分。在此缓冲区上执行写入/绘图,当完成时,整个缓冲区被交换,以便它现在被绘制在可视组件上。

As you probably know, a double buffer normally involves creating an off-screen memory buffer the same size as the visual component. Writing/drawing is performed on this buffer and when complete, the entire buffer is "swapped" so that it is now painted on the visual component.

(注意:交换可能只是简单地改变指针指向的地址,或者实际上可能涉及复制一块内存,例如使用BitBlt,memcpy等)

(Note: "swapping" may consist of simply changing the address a pointer points to, or may actually involve copying a chunk of memory such as using BitBlt, memcpy etc)

因此,为每个可启用的组件支持此过程的合理数量的内存。如果您的应用程序有许多窗口和/或组件,则分配的内存数量不会很小。如果您不需要平滑的视觉更新/滚动,为什么要浪费这些记忆?

Therefore a reasonable amount of memory allocated to support this process for each component it is enabled for. If your application has many windows or and/or components there would be a not insignificant amount of memory allocated. If you do not require smooth visual updates/scrolling, why waste this memory?

当然还有一个争论说,今天大多数电脑都有足够的内存空间,所以为什么要担心。但是,如果您不需要,我仍然不认为这是默认启用双缓冲的原因。

Of course there is also an argument that today most computers have plenty of memory to spare, so why worry. However I still don't see this as a reason to default to enabling Double Buffering if you don't need it.

如果手动将DoubleBuffered设置为true,则会导致您可以随时创建自己的从内置控件继承的自定义控件/组件,并将DoubleBuffered(和其他属性)设置为所需的默认值。

If manually setting DoubleBuffered to true is a pain for you, you could always create your own custom control/component that inherits from the built-in control, and sets DoubleBuffered (and other properties) to your required defaults.

这篇关于为什么默认情况下禁用DoubleBuffered?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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