I've had a little look at this - and I can reproduce your problem. I don't
think this is a bug with win32::gui.
From memory the InvalidateRect did fix things, but I don't think the same
approach would work for the current version of this example.
In a normal operation, InvalidateRect(1) would cause that window to be
redrawn, with the whole background being painted first. In the samples case,
we have set various options to stop the background being drawn (the
clipchildren flags and the wc class), this stops the flicker but we have to
manually repaint the background when required. When a smaller sized bitmap
is opened, the BitBlt only paints the bitmap, even though it has been given
coordinates to repaint the whole window. Somehow, the window will have to be
manually cleared in those situations (using FillRect with the system
brush?). I think that should fix things...
----- Original Message -----
From: "Glenn Linderman" <perl@...>
To: "Win32 GUI Hackers" <perl-win32-gui-hackers@...>
Sent: Tuesday, October 26, 2004 4:45 AM
Subject: [perl-win32-gui-hackers] noflicker, bitmaps, and painting the
> So I have my application that borrows liberally from the sample code
> So in my application, I change the size of the bitmap I'm displaying,
> within a window that sometimes can display the whole thing... and
> sometimes has a right/bottom border of background around it. (One might
> consider centering the image in that case, but I haven't gotten that
> Anyway, I noticed a phenomenon: When I switch from big bmp to little bmp,
> the background doesn't get redrawn so portions of the bigger bitmap are
> still visible.
> I recall that this was a problem with an early version of the sample, and
> Jez, you were able to fix it somehow. I guess that was before I really
> figured out much about how it worked, because I don't know what you fixed.
> I've made changes to the sample, in the name of fixing off by one errors,
> and scrollbar settings, and such; and then Laurent changed the way Paint
> worked. And some of my fiddlings were after Laurent.
> Somewhere along the line, it broke... display a large bitmap, and then a
> small one, and the large one still has portions remaining on the screen.
> It seems that InvalidateRect(1) is called for the window when bitmap sizes
> are changed, and I sort of thought that was the change that fixed it, but
> I could be wrong. But that is still there.
> Glenn -- http://nevcal.com/
> The best part about procrastination is that you are never bored,
> because you have all kinds of things that you should be doing.
> This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
> Use IT products in your business? Tell us what you think of them. Give us
> Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out
> Perl-Win32-GUI-Hackers mailing list