Reducing the size of a BufferedDC

Alexander 'boesi' Bösecke wrote:

Hi

I've attached an example, that shows that the size of a buffered DC
doesn't change correctly.

The size of the BufferedDC only changes, if the size in x- or
y-direction gets enlarged.

I know that this worked with version 2.6, but I don't know if it worked
with 2.7. Now I'm using version 2.8.0.1 under Windows.

Unless you are supplying your own buffer bitmap the buffered DC will use one that it creates internally. In order to save the time needed to create an initialize the bitmap each time a buffered DC is used, it will save the last bitmap used and will reuse it again, unless it needs to make a bigger one. (This was added sometime in 2.7) Your dc.GetSize() call is just giving you the size of that bitmap. Since it can only be flushed to the size of the target DC it doesn't really matter much if the buffer is bigger than needed.

So what should I do to get a buffered DC with the correct size?

Either supply your own bitmap that is the desired size, or pass the size of the target DC to your drawing function and ignore the size of the buffered DC.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!