Solved

Draw an CPictureHolder on a Dialog

Posted on 2004-07-30
3
293 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
3 Comments
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 400 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 100 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sumNumber challenge 16 124
has77  challenge 9 85
noX challenge 17 120
how to use laptop or pad camera in vb.net windows application 2 75
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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.

825 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