?
Solved

Window painting ?

Posted on 2003-03-03
5
Medium Priority
?
231 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

770 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