[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Display Metafile in CStatic frame

Posted on 1998-04-06
1
Medium Priority
?
381 Views
Last Modified: 2013-11-20
I want to display a windows metafile with a Static control.
I set the style of the control to Enhanced Metafile and I
set the handle to the metafile by the following code
      CMetaFileDC MetaDC;
      HDC hdc = ::GetDC(0);
      CRect rect(0,0,100,100);
      HDC hMetaDC = CreateEnhMetaFile(hdc,"d:\\test1.emf",&rect,NULL);
      ::ReleaseDC(0,hdc);
      HENHMETAFILE hMeta = CloseEnhMetaFile(hMetaDC);
      m_chart_layout.SetEnhMetaFile(hMeta);
But the control doesn't display the metafile!

Is there any example available?
0
Comment
Question by:yangjun
1 Comment
 
LVL 4

Accepted Solution

by:
piano_boxer earned 400 total points
ID: 1317486
1. Create a member variable for the CStatic control. Lets call it m_wndMeta;

2. In OnInitDialog get a handle of the EMF file on disk and associate it with the static control.

HENHMETAFILE h = GetEnhMetaFile( "c:\\temp\\test.emf" );
m_wndMeta.SetEnhMetaFile(h);

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month18 days, 5 hours left to enroll

830 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