This documentation is archived and is not being maintained.

Graphics.EnumerateMetafile Method (Metafile, Rectangle, Rectangle, GraphicsUnit, Graphics.EnumerateMetafileProc, IntPtr, ImageAttributes)

.NET Framework 1.1

Sends the records of a selected rectangle from a Metafile object, one at a time, to a callback method for display in a specified rectangle using specified image attributes.

[Visual Basic]
Overloads Public Sub EnumerateMetafile( _
   ByVal metafile As Metafile, _
   ByVal destRect As Rectangle, _
   ByVal srcRect As Rectangle, _
   ByVal unit As GraphicsUnit, _
   ByVal callback As Graphics.EnumerateMetafileProc, _
   ByVal callbackData As IntPtr, _
   ByVal imageAttr As ImageAttributes _
public void EnumerateMetafile(
 Metafile metafile,
 Rectangle destRect,
 Rectangle srcRect,
 GraphicsUnit unit,
 Graphics.EnumerateMetafileProc callback,
 IntPtr callbackData,
 ImageAttributes imageAttr
public: void EnumerateMetafile(
 Metafile* metafile,
 Rectangle destRect,
 Rectangle srcRect,
 GraphicsUnit unit,
 Graphics.EnumerateMetafileProc* callback,
 IntPtr callbackData,
 ImageAttributes* imageAttr
public function EnumerateMetafile(
   metafile : Metafile,
 destRect : Rectangle,
 srcRect : Rectangle,
 unit : GraphicsUnit,
 callback : Graphics.EnumerateMetafileProc,
 callbackData : IntPtr,
 imageAttr : ImageAttributes


Metafile object to enumerate.
Rectangle structure that specifies the location and size of the drawn metafile.
Rectangle structure that specifies the portion of the metafile, relative to its upper-left corner, to draw.
Member of the GraphicsUnit enumeration that specifies the unit of measure used to determine the portion of the metafile that the rectangle specified by the srcRect parameter contains.
Graphics.EnumerateMetafileProc delegate that specifies the method to which the metafile records are sent.
Internal pointer that is required, but ignored. You can pass IntPtr.Zero for this parameter.
ImageAttributes object that specifies image attribute information for the drawn image.

Return Value

This method does not return a value.


This method enumerates the records contained in the specified metafile. Each record is individually sent to a callback method specified by the callback parameter. Typically, the callback method calls the PlayRecord method to "play back", or draw, the record.

If the callback method calls Metafile.PlayRecord, it must do so by calling the PlayRecord method of the specific Metafile object that is being enumerated.

Any drawing that takes place outside of the rectangle specified by the srcRect parameter is ignored.

The image attributes specified by the imageAttr parameter replace those specified when the metafile was written.


For an example see EnumerateMetafile.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Graphics Class | Graphics Members | System.Drawing Namespace | Graphics.EnumerateMetafile Overload List