ControlStyles.DoubleBuffer 与 ControlStyles.OptimizedDoubleBuffer

发布于 2024-08-16 16:40:04 字数 258 浏览 6 评论 0原文

ControlStyles.DoubleBufferControlStyles.OptimizedDoubleBuffer 之间有什么区别?

ControlStyles.DoubleBuffer 不会显示在 Intellisense 下拉列表中,而 ControlStyles.OptimizedDoubleBuffer 实际上已列出。

MSDN 文档并没有立即明确区别(至少对我来说)。

What is the difference between ControlStyles.DoubleBuffer and ControlStyles.OptimizedDoubleBuffer?

ControlStyles.DoubleBuffer does not show up in the Intellisense drop down whereas ControlStyles.OptimizedDoubleBuffer is in fact listed.

The MSDN documentation does not make the difference immediately clear (to me at least).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

拍不死你 2024-08-23 16:40:04

我找到了线程关于这个问题。

注意:下面是关于受保护的 Control 属性,而不是 ControlStyles

DoubleBuffered = true 设置 ControlStyles.OptimizedDoubleBuffer 和 ControlStyles.AllPaintingInWmPaint。

根据 WinForms 文档,以上是首选用法。
或者,也可以通过 SetStyle 设置 ControlStyle。

在某一时刻,我们的目的是弃用 DoubleBuffer 并采用 OptimizedDoubleBuffer 来代替,但是该线程探讨了为什么这可能是一个坏主意的原因(我不明白)

看起来整个情况有点混乱,但最终这些两个标志做的事情非常相似 - 该线程表明 OptimizedDoubleBuffer 和 DoubleBuffer 之间仍然存在细微差别,但没有解释它们是什么。

I found this thread on the subject.

Note: below is about the protected Control property, not the ControlStyles:

DoubleBuffered = true sets both ControlStyles.OptimizedDoubleBuffer AND ControlStyles.AllPaintingInWmPaint.

Per WinForms documentation, above is the preferred usage.
Alternatively one could set the ControlStyle as well through SetStyle.

At one point the intention was to deprecate DoubleBuffer and adopt the use of OptimizedDoubleBuffer instead, however the thread goes into reasons why that might be a bad idea (that I dont understand)

It looks like the whole situation is a tad confused, however ultimately these two flags do very similar things - the thread indicates that there are still subtle differences between OptimizedDoubleBuffer and DoubleBuffer, but doesnt explain what they are.

南城旧梦 2024-08-23 16:40:04

有趣的。引导我在网上搜索。

来自 Microsoft

OptimizedDoubleBuffer 的文档指出,它将有助于减少闪烁,并且与将 UserPaint 和 AllPaintingInWmPaint ControlStyles 设置为 true 具有相同的效果。但是,如果将 OptimizedDoubleBuffer ControlStyle 设置为 true 而不设置 UserPaint 和 AllPaintingInWmPaint,则不会明显减少闪烁。
设置 UserPaint 和 AllPaintingInWmPaint ControlStyles 将产生与在 Visual Studio 2003 中设置 DoubleBuffer、UserPaint 和 AllPaintingInWmPaint ControlStyles 时相同的减少闪烁优化效果。换句话说 - OptimizedDoubleBuffer 和过时的 DoubleBuffer 之间似乎没有任何区别。

http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx ?反馈ID=94096

Interesting. Lead me to search in web.

from Microsoft

The documentation for OptimizedDoubleBuffer indicates that it will help to reduce flicker and has the same effect as setting the UserPaint and AllPaintingInWmPaint ControlStyles to true. However, if the OptimizedDoubleBuffer ControlStyle is set to true without setting UserPaint and AllPaintingInWmPaint there is no visible reduction of flickering.
Setting the UserPaint and AllPaintingInWmPaint ControlStyles will result in the same reduced flicker optimisation as in Visual Studio 2003 when setting the DoubleBuffer, UserPaint and AllPaintingInWmPaint ControlStyles. In other words - there doesn't seem to be any difference between OptimizedDoubleBuffer and the obsolete DoubleBuffer.

http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=94096

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文