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

VIEWS_API CODMetafileComponent()

Constructor.

VIEWS_API CODMetafileComponent(const CODMetafileComponent& src)

Copy constructor.

VIEWS_API virtual ~CODMetafileComponent()

Destructor.

HENHMETAFILE m_hMetafile

Handle to enhanced metafile.

VIEWS_API BOOL Create()

Creates the metafile component with a default bounding box.

VIEWS_API BOOL Create(const CRect& rect)

Creates the metafile component given a bounding box.

VIEWS_API BOOL LoadFromFile(LPCTSTR lpszFileName)

Loads the metafile from a file.

VIEWS_API BOOL LoadFromResource(UINT nResId)

Loads the metafile from a resource.

VIEWS_API BOOL LoadFromResource(UINT nResId, HINSTANCE hInst)

Loads the metafile from a resource.

VIEWS_API BOOL Attach(const HENHMETAFILE hMetafile)

Attach the handle to the metafile component.

VIEWS_API BOOL Copy(const HENHMETAFILE hMetafile)

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

VIEWS_API BOOL SetLocalBounds(const CRect& rect)

Sets the local points to the given logical rectangle.

VIEWS_API CODMetafileComponent& operator=(const CODMetafileComponent& src)

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

VIEWS_API virtual CODComponent* Dup() const

Creates a copy of this component.

VIEWS_API HENHMETAFILE GetHandle() const

Return the metafile handle.

VIEWS_API BOOL Delete()

Delete the metafile handle.

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

Get header information for metafile.

VIEWS_API UINT GetDescription(CString& strDescription) const

Get description of metafile.

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

Return the width and height of the metafile frame.

VIEWS_API BOOL GetLogFrame(IODRuler* pIRuler, CRect& rcFrame)

Return the metafile frame in logical units.

VIEWS_API BOOL SizeToFrame(IODRuler* pIRuler)

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

VIEWS_API virtual void OnDraw(CDC* pDC)

Plays the metafile onto a device context.

VIEWS_API virtual void Serialize(CArchive& ar)

Serializes the metafile component.

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

Calculates the new position of a vertex being moved.