Skip to main content
gamedev.net
🔒 Locked

GDI+ Bitmap Problem

Started by MattOranges Nov 23, 2011 at 1:20 PM 0 replies 800+ views
Original Post
MattOranges
MattOranges
Hi, I have basically this state machine deciding what background image to draw to my window. My code is here: http://codepad.org/wCRPZA8l

The correct state is getting to WM_PAINT, and it is entering the correct if statement, but after the initial run through where it draws hydra.jpg, it wont draw any of the new bitmaps. On subsequent calls it runs the lines


Bitmap bitbackhydra(L"slave.jpg");
windowgraphics.DrawImage(&bitbackslave, drawspace);

But the image never appears, and hydra.jpg stays on the screen, meaning:
windowgraphics.Clear(Color::White);

Is not even being executed, even though i can see through debugging it passes over this line...

Any help would be great! thanks!
MattOranges
MattOranges
As a favor to anyone in the future with this problem, I had to invalidate the window region before WM_PAINT would actually redraw the window.

InvalidateRgn(hWnd, NULL, true);

Will invalidate the entire client area. Call this before the UpdateWindow function.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.