Solved

Display Metafile in CStatic frame

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
bobThere java chalenge 45 85
Turn a spreadsheet into a vba executable. 2 66
Folder Comparison 12 52
Problem to open Excel file 15 44
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: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

747 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

9 Experts available now in Live!

Get 1:1 Help Now