2025-11-27 16:46:48 +09:00

34 lines
2.8 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{\rtf1\ansi\ansicpg1252\deff0\deftab720{\fonttbl{\f0\fswiss MS Sans Serif;}{\f1\froman\fcharset2 Symbol;}{\f2\froman Times New Roman;}{\f3\froman Times New Roman;}}
{\colortbl\red0\green0\blue0;\red128\green0\blue128;\red255\green0\blue0;\red0\green0\blue255;}
\deflang4105\horzdoc{\*\fchars }{\*\lchars }\pard\plain\f3\fs48\cf1\b Class Overview: \plain\f3\fs48\cf2\b OXMetaFile\plain\f3\fs48\b
\par \plain\f3\fs24
\par \plain\f3\fs24\b
\par \plain\f3\fs24\cf3\b\ul COXMetaFile\plain\f3\fs24 is a class that allows access to metafiles in different formats:
\par
\par old Windows 3.x metafile (*.wmf)
\par Windows metafile with Aldus header (*.wmf)
\par new enhanced Windows metafile (*.emf)
\par
\par \pard\qc\plain\f3\fs24\b Loading the MetaFile from a disk file\plain\f3\fs24
\par \pard\plain\f3\fs24 The files can be loaded from disk. Use the \plain\f3\fs24\cf3\ul LoadFile\plain\f3\fs24 () method. If you don't set the filename then COXMetaFile will prompt the user for it, using a standard CFileDialog. COXMetaFile supports all different metafile formats and recognizes them internally.
\par
\par \pard\qc\plain\f3\fs24\b Loading the MetaFile from a resource\plain\f3\fs24
\par \pard\plain\f3\fs24 The Metafile can be loaded from an application resource file. You just call LoadFile( nID ) with the corresponding resource ID set. Normally it's a user defined resource type called "METAFILE", but other names are possible. This is a useful feature if you want to start your program with a screen picture loaded from within the program or come up with a default picture if a metafile is not found on disk.
\par
\par \pard\qc\plain\f3\fs24\b Play a metafile\plain\f3\fs24
\par \pard\plain\f3\fs24 All you need to do is to call the \plain\f3\fs24\cf3\ul PlayFile\plain\f3\fs24 method in your CMyView::OnDraw() method.
\par pDoc->m_MetaFile.\plain\f3\fs24\cf3\ul PlayFile\plain\f3\fs24 (pDC);
\par
\par If you want to display the metafile in the client rectangle and maintain the metafile's ratio, you have to pass the client rectangle to PlayFile:
\par pDoc-m_MetaFile.\plain\f3\fs24\cf3\ul PlayFile\plain\f3\fs24 (pDC, &rectClient);
\par
\par The MetaFile class will internally adjust the MapMode, WindowExt and ViewportExt according to the Metafile size.
\par
\par \pard\qc\plain\f3\fs24\b Create a Metafile (enhanced format)\plain\f3\fs24
\par \pard\plain\f3\fs24 COXMetaFile only creates enhanced metafiles.
\par You must call \plain\f3\fs24\cf3\ul CreateFile()\plain\f3\fs24 to create the MetaFile. This method will prompt the user for a filename if it is not passed as a parameter.
\par Second, you need to perform all drawing operations on the DC returned by \plain\f3\fs24\cf3\ul CreateFile()\plain\f3\fs24
\par Finally close the metafile using \plain\f3\fs24\cf3\ul CloseFile\plain\f3\fs24 ().
\par \plain\lang1033\f2\fs20
\par }