Solved

Display Metafile in CStatic frame

Posted on 1998-04-06
1
375 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Suggested Solutions

Title # Comments Views Activity
Expand LInux Boot partition remotly 3 102
dog bark java program 15 121
maven archtype selection in eclipse 1 58
sum67 challenge 35 116
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

733 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