CStatic::SetEnhMetaFile

Associates a new enhanced metafile image with the static control.

HENHMETAFILE SetEnhMetaFile( 
   HENHMETAFILE hMetaFile  
);

Parameters

  • hMetaFile
    Handle of the enhanced metafile to be drawn in the static control.

Return Value

The handle of the enhanced metafile previously associated with the static control, or NULL if no enhanced metafile was associated with the static control.

Remarks

The enhanced metafile will be automatically drawn in the static control. The enhanced metafile is scaled to fit the size of the static control.

You can use various window and static control styles, including the following:

  • SS_ENHMETAFILE   Use this style always for enhanced metafiles.

Example

CStatic myStatic;

// Create a child enhanced metafile static control.
myStatic.Create(_T("my static"), 
   WS_CHILD|WS_VISIBLE|SS_ENHMETAFILE|SS_CENTERIMAGE, 
   CRect(10,10,150,50), pParentWnd);

// If no image is defined for the static control, define the image  
// to be "myemf.emf." 
if (myStatic.GetEnhMetaFile() == NULL)
   myStatic.SetEnhMetaFile(::GetEnhMetaFile(_T("myemf.emf")));   

Requirements

Header: afxwin.h

See Also

Reference

CStatic Class

Hierarchy Chart

CStatic::GetEnhMetaFile

STM_SETIMAGE