Solved

Display Metafile in CStatic frame

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeatSeparator  java  challenge 13 57
move a line in eclipse 3 102
FizzBuzz challenge 9 80
Problem to event 3 96
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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 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.

770 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