?
Solved

Window painting ?

Posted on 2003-03-03
5
Medium Priority
?
232 Views
Last Modified: 2013-11-20
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);
    if (hBmp)
        {
        m_providerBitmap.SetBitmap(hBmp);
        }
0
Comment
Question by:jpacheco
3 Comments
 
LVL 8

Expert Comment

by:Answers2000
ID: 8069598
I think the problem is the built-in dialog code does it's own painting of the background

In resources, put a Static where the bitmap goes

Create a CStatic derived class

Associate a control of the derived class with that static in the dialog.

Put the painting in the derived classes's OnPaint

You shouldn't get these problems this way round


0
 

Author Comment

by:jpacheco
ID: 8070851

Thanks, I'll give that a shot.
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 11812367
PAQed - no points refunded (of 50)

modulo
Community Support Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question