I must display graphic information in such a way that the user can scale and move the drawing interactively. For some reason, I decided the best way is to store my graphical information in a metafile; the visualization mechanism takes care of playing this metafile in the screen context, after preparing an MM_ANISOTROPIC mapping mode with the window and viewport origin and extents set properly. This works fine.
I must include, as part of my graphical information, a metafile. The metafiles are Aldus placeable metafiles, but my problem is that they include records as SetWindowExt and SetWindowOrg (and possibly even SetViewportExt and SetViewportOrg). I save my mapping mode and metrics with SaveDC and RestoreDC, but the included metafile always appears with the same position and size.
How can I force such a metafile to draw itself in a position and size controlled by my own initial calls to Set...Ext and Set...Org, as the rest of the elements I draw?
Thank you very much, doc. (A T-shirt will be appreciated.)
Regards,
Alfredo Moran
They always render the same size. The placeable metafile was designed to address WYSIWYG concerns. It worked well but has always been confusing to developers. The ultimate solution is to use enhanced metafiles (EMF). There are Win32 functions that convert older-style Windows metafiles (WMF) to EMF. But this still does not address all issues associated with placeable metafiles.
The problem you are encountering is the tight coupling between the window origin and extents (that are included in the metafile), and the boundaries and extents used in the subsequent metafile records. The only way to decouple these effectively is to enumerate the metafile and skip over any coordinate mapping records. However, you will want at least to observe what was going on in these records, because you will need to set your own coordinate mapping system to achieve the scaling you are looking for. It is better to do this than adjusting the parameters of all subsequent records.