Solved

Display Metafile in CStatic frame

Posted on 1998-04-06
1
369 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 200 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
bobThere java chalenge 45 89
maxBlock challenge 30 111
Prevent this page from creating additional dialogs. 3 388
Use of condition with 'serial' in ansible 2 49
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…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

929 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now