Help on metafiles
Posted on 2001-08-23
I have programmed an application that display 1D and 2D plots. In this application I'm using MM_TWIPS mapping mode to get a WYSIWYG interface with zooming capabilities. All this works just fine.
Now I want to copy the graphics to the clipboard as an enhanced metafiles but until now I wasn't able to get it to work correctly. The following is the code I'm using, pretty simple:
CMetaFileDC * m_pMetaDC = new CMetaFileDC();
//draw meta file
m_pMetaDC->m_hAttribDC = clientDC.m_hDC;
//close meta file dc and prepare for clipboard;
HENHMETAFILE hMF = m_pMetaDC->CloseEnhanced();
//copy to clipboard
This code used to work properly in older versions of my application in which I used MM_TEXT mapping mode. However, with MM_TWIPS, after pasting the metafile into MS Word, I get an inversed metafile along the Y-axis.
I also had to use a little trick in order the metifle DC to support GDI functions such as LPtoDP, GetClipBox and others. This trick was the line m_pMetaDC->m_hAttribDC = clientDC.m_hDC;
Any idea about how to solve this problem?