none
OptimizedDoubleBuffer RRS feed

  • Question

  • I heard somewhere that by setting ControlStyle.OptimizedDoubleBuffer, you automatically have ControlStyle.UserPaint and ControlStyle.AllPaintingInWmPaint set as well.

    Is this true?
    Tuesday, May 3, 2005 11:51 AM

Answers

  • This got tweaked in January:

    1. DoubleBuffered = true sets both ControlStyles.OptimizedDoubleBuffer AND ControlStyles.AllPaintingInWmPaint.
    2. OptimizedDoubleBuffer does not set any other controlstyles.

    Tuesday, May 3, 2005 10:57 PM
  • That's a really good question.

    ControlStyles == CS
    AllPaintingInWMPaint == APWMP
    OptimizedDoubleBuffer = ODB
    DoubleBuffer = DB

    An earlier permutation of the design called for ODB to simply be a combination of DB, APWMP and UserPaint. Through several design changes, the two control styles are nearly synonymous, but they still have differences.  Now that we've broken that, we may consider un-deprecating CS.DB to retain . Here is a more complete summary of the current design:

    Mechanism Side effects Other flags required to work Require APWMP? Notes
    ControlStyle
    .DB

    none

    APWMP, UserPaint

    Yes

    We are considering NOT deprecating this flag because ODB isn't an exact replacement for DB.
    ControlStyle
    .ODB

    none

    none

    No

    Works, but without APWMP set you'll buffer foreground and background separately and will still see flicker.
    Control
    .DoubleBuffered

    sets CS.ODB, CS.APWMP

    none

    No

    Works for most mainstream buffering needs. Getter is peculiar in that it only checks CS.ODB.


    I'm following up on the need for deprecating CS.DB and Control.DoubleBuffered's getter and will post here.
    Tuesday, May 31, 2005 8:56 PM
  • Action: We will pull the Obsolete attribute off ControlStyles.DoubleBuffer.

    (side note) We considered cleaning up the API (ripping ODB) but adoption of the OptimizedDoubleBuffer flag within is high - meaning that it would break a lot of people. This is an ugly one we'll simply have doc and leave in the product. :(

    Wednesday, June 15, 2005 11:13 PM

All replies

  • This got tweaked in January:

    1. DoubleBuffered = true sets both ControlStyles.OptimizedDoubleBuffer AND ControlStyles.AllPaintingInWmPaint.
    2. OptimizedDoubleBuffer does not set any other controlstyles.

    Tuesday, May 3, 2005 10:57 PM
  • Thanks, Erick.

    And, because DoubleBuffered is deprecated, we need to manually set both OptimizedDoubleBuffer and AllPaintingInWmPaint if we want those behaviors? Or, is DoubleBuffered making a comeback?

    Cheers,
    Michael
    Tuesday, May 17, 2005 10:11 PM
  • sorry this took so long...Control.DoubleBuffered is new and generally goodness. ControlStyles.DoubleBuffer use should be avoided.
    Friday, May 27, 2005 2:48 AM
  • What was the reason for ControlStyles.DoubleBuffer deprecation?

    And what are the differences between DoubleBuffer and the now new OptimizedDoubleBuffer?

    Saturday, May 28, 2005 2:07 AM
    Moderator
  • That's a really good question.

    ControlStyles == CS
    AllPaintingInWMPaint == APWMP
    OptimizedDoubleBuffer = ODB
    DoubleBuffer = DB

    An earlier permutation of the design called for ODB to simply be a combination of DB, APWMP and UserPaint. Through several design changes, the two control styles are nearly synonymous, but they still have differences.  Now that we've broken that, we may consider un-deprecating CS.DB to retain . Here is a more complete summary of the current design:

    Mechanism Side effects Other flags required to work Require APWMP? Notes
    ControlStyle
    .DB

    none

    APWMP, UserPaint

    Yes

    We are considering NOT deprecating this flag because ODB isn't an exact replacement for DB.
    ControlStyle
    .ODB

    none

    none

    No

    Works, but without APWMP set you'll buffer foreground and background separately and will still see flicker.
    Control
    .DoubleBuffered

    sets CS.ODB, CS.APWMP

    none

    No

    Works for most mainstream buffering needs. Getter is peculiar in that it only checks CS.ODB.


    I'm following up on the need for deprecating CS.DB and Control.DoubleBuffered's getter and will post here.
    Tuesday, May 31, 2005 8:56 PM
  • Erick,

    So in summary, the difference between ControlStyles.DoubleBuffer and ControlStyles.OptimizedDoubleBuffer is that with OptimizedDoubleBuffer you can still get a PaintBackground event if ControlStyles.AllPaintingInWmPaint is not set, otherwise if ControlStyles.AllPaintingInWmPaint is set, they are the same.

    Is that a correct summary?

    This seems like a small difference. I think having both the DoubleBuffer and OptimizedDoubleBuffer styles is confusing to the user, and it would be good if you had some way of merging them back into a single style.

    Tuesday, May 31, 2005 9:22 PM
    Moderator
  • Action: We will pull the Obsolete attribute off ControlStyles.DoubleBuffer.

    (side note) We considered cleaning up the API (ripping ODB) but adoption of the OptimizedDoubleBuffer flag within is high - meaning that it would break a lot of people. This is an ugly one we'll simply have doc and leave in the product. :(

    Wednesday, June 15, 2005 11:13 PM
  • How about placing it on OptimizedDoubleBuffer instead (the obsolete attribute)?

    Sometimes I think you just need to make breaking changes between the beta and RTM if those changes are going to make it easier for users to delve into the Framework.

    I've been working with the Framework, especially Windows Forms consistantly for the last three years and I was confused about the difference between the two. How are new users going to grapple with it?

    Thursday, June 16, 2005 12:17 PM
    Moderator
  • The API is unfortunate, but it is a ControlStyle which affects a minority of users. Typically, we'd suggest Control.DoubleBuffered.

    Marking Obsolete is akin to ripping it - we generate build warnings for every project where it's being used. It's just plain too late for the change and we'll have to rely on the docs to explain i

    Thursday, June 16, 2005 11:07 PM