ControlStyles.DoubleBuffer 与 ControlStyles.OptimizedDoubleBuffer
ControlStyles.DoubleBuffer 和 ControlStyles.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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我找到了此线程关于这个问题。
注意:下面是关于受保护的
Control
属性,而不是ControlStyles
:根据 WinForms 文档,以上是首选用法。
或者,也可以通过
SetStyle
设置 ControlStyle。在某一时刻,我们的目的是弃用 DoubleBuffer 并采用 OptimizedDoubleBuffer 来代替,但是该线程探讨了为什么这可能是一个坏主意的原因(我不明白)
看起来整个情况有点混乱,但最终这些两个标志做的事情非常相似 - 该线程表明 OptimizedDoubleBuffer 和 DoubleBuffer 之间仍然存在细微差别,但没有解释它们是什么。
I found this thread on the subject.
Note: below is about the protected
Control
property, not theControlStyles
: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.
有趣的。引导我在网上搜索。
来自 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