CODMetafileComponent Class

class CODMetafileComponent: public CODPointComponent

The metafile component encapsulates a Windows enhanced metafile object. The class contains methods for loading and drawing the metafile as a component. The metafile component contains four points that define the bounding rectangle in local coordinates. Transformations are applied to the local coordinates to produce world coordinates. The bounding box for the world coordinates is the rectangle used for drawing the metafile. The  OnDraw method plays the metafile into the bounding rectangle defined by the world coordinates. World coordinates are still logical coordinates, and are not mapped to device coordinates until used in a device context.

Windows 3.1 metafiles are not supported. Rotation is not currently supported for metafile components.

Defined in: OdMetafileComp.h

Class Members

 CODMetafileComponent()

Constructor.

 CODMetafileComponent(const CODMetafileComponent& src)

Copy constructor.

virtual  ~CODMetafileComponent()

Destructor.

HENHMETAFILE m_hMetafile

Handle to enhanced metafile.

BOOL  Create()

Creates the metafile component with a default bounding box.

BOOL  Create(const CRect& rect)

Creates the metafile component given a bounding box.

BOOL  LoadFromFile(LPCTSTR lpszFileName)

Loads the metafile from a file.

BOOL  LoadFromResource(UINT nResId)

Loads the metafile from a resource.

BOOL  LoadFromResource(UINT nResId, HINSTANCE hInst)

Loads the metafile from a resource.

BOOL  Attach(const HENHMETAFILE hMetafile)

Attach the handle to the metafile component.

BOOL  Copy(const HENHMETAFILE hMetafile)

Make a copy of the given metafile and assign it to this component.

BOOL  SetLocalBounds(const CRect& rect)

Sets the local points to the given logical rectangle.

CODMetafileComponent&  operator=(const CODMetafileComponent& src)

Assignment operator: sets the component's attributes equal to&#09that of the r-value component.

virtual CODComponent*  Dup() const

Creates a copy of this component.

HENHMETAFILE  GetHandle() const

Return the metafile handle.

BOOL  Delete()

Delete the metafile handle.

UINT  GetHeaderInfo(ENHMETAHEADER* pHdrInfo, UINT cbBuffer = sizeof(ENHMETAHEADER)) const

Get header information for metafile.

UINT  GetDescription(CString& strDescription) const

Get description of metafile.

BOOL  GetFrameSize(CODMeasure& width, CODMeasure& height) const

Return the width and height of the metafile frame.

BOOL  GetLogFrame(IODRuler* pIRuler, CRect& rcFrame)

Return the metafile frame in logical units.

BOOL  SizeToFrame(IODRuler* pIRuler)

Adjust logical size of component to match frame size stored in original metafile.

virtual void  OnDraw(CDC* pDC)

Plays the metafile onto a device context.

virtual void  Serialize(CArchive& ar)

Serializes the metafile component.

virtual OD_MOVEVERTEX_RC  CalculateMovedVertices(int nIndex, int nOffsetX, int nOffsetY)

Calculates the new position of a vertex being moved.