ControlStyles.DoubleBuffer vs. ControlStyles.OptimizedDoubleBuffer

好久不见. 提交于 2019-12-18 19:01:30

问题


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).


回答1:


I found this thread on the subject:

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

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.




回答2:


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



来源:https://stackoverflow.com/questions/1967228/controlstyles-doublebuffer-vs-controlstyles-optimizeddoublebuffer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!