Window painting ?
Posted on 2003-03-03
I've got a dialog based MFC app that seems to work fine except for displaying a bitmap on the window. I've got a bitmap that I need to display on the dialog box. The bitmap is located in a file and I wrote a procedure to get the bitmap and to display it. I put a call to the procedure in On_InitDialog() and On_Paint(). It displays OK if I move the window around, but not initially (without moving the window).
There are 2 problems: 1) The initial call in On_InitDialog() get overwritten by the static controls in the dialog instead of the other way around, and
2) The bitmap does not get updated after it has been partially covered. The bitmap is left in a partially rendered state.
I presume that I have forgotten to put a call to update the bitmap someplace. Any pointers to fixing this would be most appreciated.
For what it's worth, here a partial code snipet that does the drawing:
HBITMAP hBmp = (HBITMAP) ::LoadImage (NULL, (LPCTSTR)fullFileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);