?
Solved

Draw an CPictureHolder on a Dialog

Posted on 2004-07-30
3
Medium Priority
?
325 Views
Last Modified: 2013-11-20
I'm trying to render a CPictureHolder image onto a dialog.  I've posted my code below, but it's not working.

CPictureHolderEx      pic;
      CDC                              *dc;
      CRect                        crClient;
      CRect                        crPic;
      CStatic                        *frame;


      frame = (CStatic*)this->GetDlgItem(IDC_FRAME);
      frame->GetWindowRect(&crPic);
      GetClientRect(&crClient);
      GetClientRect(&crPic);
      pic.OleLoadPictureFromFile("c:\\test.jpg");
      dc = this->GetDC();
      pic.Render(dc,crPic,crClient);
0
Comment
Question by:lwinkenb
[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
3 Comments
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 1600 total points
ID: 11683389
On dialog?
You need to do the rendering in the OnPaint else it is 'removed' by the default OnPaint which will cover the client area by the background colour.  (Load it in OnInitDialog - that is just called once).
0
 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 400 total points
ID: 11684483
Also put your CPictureHolderEx object as a dialog member (in .h)
Put this sentence in the OnInitDialog() function as recommended by Andy:      pic.OleLoadPictureFromFile("c:\\test.jpg");
Put the rest of code in the OnPaint Event.

0
 
LVL 5

Author Comment

by:lwinkenb
ID: 11686028
Thanks for the help guys, that did it.
0

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Suggested Courses

801 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