Metafile 클래스

정의

그래픽 메타파일을 정의합니다. 메타파일에는 기록(생성) 및 재생(표시)할 수 있는 그래픽 작업 시퀀스를 설명하는 레코드가 들어 있습니다. 이 클래스는 상속될 수 없습니다.

public ref class Metafile sealed : System::Drawing::Image
public sealed class Metafile : System.Drawing.Image
[System.Serializable]
public sealed class Metafile : System.Drawing.Image
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(false)]
public sealed class Metafile : System.Drawing.Image
type Metafile = class
    inherit Image
[<System.Serializable>]
type Metafile = class
    inherit Image
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(false)>]
type Metafile = class
    inherit Image
Public NotInheritable Class Metafile
Inherits Image
상속
특성

예제

다음 코드 예제를 만들고 Metafile 사용 PlayRecord 하는 방법을 보여 줍니다는 메서드.


using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;

// for Marshal.Copy
using System.Runtime.InteropServices; 

public class Form1 : Form
{
    private Metafile metafile1;
    private Graphics.EnumerateMetafileProc metafileDelegate;
    private Point destPoint;
    public Form1()
    {
        metafile1 = new Metafile(@"C:\Test.wmf");
        metafileDelegate = new Graphics.EnumerateMetafileProc(MetafileCallback);
        destPoint = new Point(20, 10);
    }
    protected override void OnPaint(PaintEventArgs e)
    {
        e.Graphics.EnumerateMetafile(metafile1, destPoint, metafileDelegate);
    }
    private bool MetafileCallback(
       EmfPlusRecordType recordType,
       int flags,
       int dataSize,
       IntPtr data,
       PlayRecordCallback callbackData)
    {
        byte[] dataArray = null;
        if (data != IntPtr.Zero)
        {
            // Copy the unmanaged record to a managed byte buffer 
            // that can be used by PlayRecord.
            dataArray = new byte[dataSize];
            Marshal.Copy(data, dataArray, 0, dataSize);
        }

        metafile1.PlayRecord(recordType, flags, dataSize, dataArray);

        return true;
    }

    static void Main()
    {
        Application.Run(new Form1());
    }
}
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.Windows.Forms
' for Marshal.Copy
Imports System.Runtime.InteropServices


Public Class Form1
    Inherits Form
    Private metafile1 As Metafile
    Private metafileDelegate As Graphics.EnumerateMetafileProc
    Private destPoint As Point
    
    Public Sub New() 
        metafile1 = New Metafile("C:\test.wmf")
        metafileDelegate = New Graphics.EnumerateMetafileProc(AddressOf MetafileCallback)
        destPoint = New Point(20, 10)
    
    End Sub
    
    Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) 
        e.Graphics.EnumerateMetafile(metafile1, destPoint, metafileDelegate)
    
    End Sub
    
    Private Function MetafileCallback(ByVal recordType As _
        EmfPlusRecordType, ByVal flags As Integer, ByVal dataSize As Integer, _
        ByVal data As IntPtr, ByVal callbackData As PlayRecordCallback) As Boolean

        Dim dataArray As Byte() = Nothing
        If data <> IntPtr.Zero Then

            ' Copy the unmanaged record to a managed byte buffer 
            ' that can be used by PlayRecord.
            dataArray = New Byte(dataSize) {}
            Marshal.Copy(data, dataArray, 0, dataSize)
        End If

        metafile1.PlayRecord(recordType, flags, dataSize, dataArray)
        Return True

    End Function
    
    Shared Sub Main() 
        Application.Run(New Form1())
    End Sub

End Class

설명

메서드를 Save 사용하여 그래픽 이미지를 WMF(Windows 메타파일 형식) 또는 EMF(Enhanced Metafile Format) 파일로 저장하는 경우 결과 파일은 PNG(이식 가능한 네트워크 그래픽) 파일로 저장됩니다. 이 동작은 .NET Framework GDI+ 구성 요소에 파일을 .wmf 또는 .emf 파일로 저장하는 데 사용할 수 있는 인코더가 없기 때문에 발생합니다.

참고

.NET 6 이상 버전에서는 이 형식을 포함하는 System.Drawing.Common 패키지가 Windows 운영 체제에서만 지원됩니다. 플랫폼 간 앱에서 이 형식을 사용하면 컴파일 시간 경고 및 런타임 예외가 발생합니다. 자세한 내용은 Windows에서만 지원되는 System.Drawing.Common을 참조하세요.

생성자

Metafile(IntPtr, Boolean)

지정된 핸들을 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(IntPtr, EmfType)

디바이스 컨텍스트에 대한 지정된 핸들 및 Metafile의 형식을 지정하는 EmfType 열거형을 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(IntPtr, EmfType, String)

디바이스 컨텍스트에 대한 지정된 핸들 및 Metafile의 형식을 지정하는 EmfType 열거형을 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다. 파일의 이름을 지정하기 위해 문자열을 제공할 수 있습니다.

Metafile(IntPtr, Rectangle)

지정된 사각형을 경계로 하고 지정된 디바이스 컨텍스트를 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(IntPtr, Rectangle, MetafileFrameUnit)

제공된 단위를 사용하는 지정된 사각형을 경계로 하고 지정된 디바이스 컨텍스트를 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(IntPtr, Rectangle, MetafileFrameUnit, EmfType)

제공된 단위를 사용하는 지정된 사각형을 경계로 하고 지정된 디바이스 컨텍스트와 Metafile의 형식을 지정하는 EmfType 열거형을 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(IntPtr, Rectangle, MetafileFrameUnit, EmfType, String)

제공된 단위를 사용하는 지정된 사각형을 경계로 하고 지정된 디바이스 컨텍스트와 Metafile의 형식을 지정하는 EmfType 열거형을 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다. 파일의 이름을 지정하기 위해 문자열을 제공할 수 있습니다.

Metafile(IntPtr, RectangleF)

지정된 사각형을 경계로 하고 지정된 디바이스 컨텍스트를 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(IntPtr, RectangleF, MetafileFrameUnit)

제공된 단위를 사용하는 지정된 사각형을 경계로 하고 지정된 디바이스 컨텍스트를 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(IntPtr, RectangleF, MetafileFrameUnit, EmfType)

제공된 단위를 사용하는 지정된 사각형을 경계로 하고 지정된 디바이스 컨텍스트와 Metafile의 형식을 지정하는 EmfType 열거형을 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(IntPtr, RectangleF, MetafileFrameUnit, EmfType, String)

제공된 단위를 사용하는 지정된 사각형을 경계로 하고 지정된 디바이스 컨텍스트와 Metafile의 형식을 지정하는 EmfType 열거형을 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다. 파일의 이름을 지정하기 위해 문자열을 제공할 수 있습니다.

Metafile(IntPtr, WmfPlaceableFileHeader)

지정된 핸들과 Metafile를 사용하여 WmfPlaceableFileHeader 클래스의 새 인스턴스를 초기화합니다.

Metafile(IntPtr, WmfPlaceableFileHeader, Boolean)

지정된 핸들과 Metafile를 사용하여 WmfPlaceableFileHeader 클래스의 새 인스턴스를 초기화합니다. 메타파일이 삭제될 때 deleteWmf 매개 변수를 사용하여 핸들을 삭제할 수도 있습니다.

Metafile(Stream)

지정된 데이터 스트림에서 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(Stream, IntPtr)

지정된 데이터 스트림에서 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(Stream, IntPtr, EmfType)

지정된 데이터 스트림, 디바이스 컨텍스트에 대한 창 핸들 및 Metafile의 형식을 지정하는 EmfType 열거형을 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(Stream, IntPtr, EmfType, String)

지정된 데이터 스트림, 디바이스 컨텍스트에 대한 창 핸들 및 Metafile의 형식을 지정하는 EmfType 열거형을 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다. 새 Metafile에 대한 설명이 포함된 이름이 들어 있는 문자열을 추가할 수도 있습니다.

Metafile(Stream, IntPtr, Rectangle)

지정된 데이터 스트림, 디바이스 컨텍스트에 대한 창 핸들 및 새 Metafile을 제한하는 사각형을 나타내는 Rectangle 구조체를 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(Stream, IntPtr, Rectangle, MetafileFrameUnit)

지정된 데이터 스트림, 디바이스 컨텍스트에 대한 창 핸들, 새 Metafile을 제한하는 사각형을 나타내는 Rectangle 구조체 및 제공된 단위를 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(Stream, IntPtr, Rectangle, MetafileFrameUnit, EmfType)

지정된 데이터 스트림, 디바이스 컨텍스트에 대한 창 핸들, 새 Metafile을 제한하는 사각형을 나타내는 Rectangle 구조체, 제공된 단위 및 Metafile의 형식을 지정하는 EmfType 열거형을 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(Stream, IntPtr, Rectangle, MetafileFrameUnit, EmfType, String)

지정된 데이터 스트림, 디바이스 컨텍스트에 대한 창 핸들, 새 Metafile을 제한하는 사각형을 나타내는 Rectangle 구조체, 제공된 단위 및 Metafile의 형식을 지정하는 EmfType 열거형을 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다. 새 Metafile에 대한 설명이 포함된 이름이 들어 있는 문자열을 추가할 수 있습니다.

Metafile(Stream, IntPtr, RectangleF)

지정된 데이터 스트림, 디바이스 컨텍스트에 대한 창 핸들 및 새 Metafile을 제한하는 사각형을 나타내는 RectangleF 구조체를 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(Stream, IntPtr, RectangleF, MetafileFrameUnit)

지정된 데이터 스트림, 디바이스 컨텍스트에 대한 창 핸들, 새 Metafile을 제한하는 사각형을 나타내는 RectangleF 구조체 및 제공된 단위를 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(Stream, IntPtr, RectangleF, MetafileFrameUnit, EmfType)

지정된 데이터 스트림, 디바이스 컨텍스트에 대한 창 핸들, 새 Metafile을 제한하는 사각형을 나타내는 RectangleF 구조체, 제공된 단위 및 Metafile의 형식을 지정하는 EmfType 열거형을 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(Stream, IntPtr, RectangleF, MetafileFrameUnit, EmfType, String)

지정된 데이터 스트림, 디바이스 컨텍스트에 대한 창 핸들, 새 Metafile을 제한하는 사각형을 나타내는 RectangleF 구조체, 제공된 단위 및 Metafile의 형식을 지정하는 EmfType 열거형을 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다. 새 Metafile에 대한 설명이 포함된 이름이 들어 있는 문자열을 추가할 수 있습니다.

Metafile(String)

지정된 파일 이름을 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(String, IntPtr)

지정한 파일 이름을 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(String, IntPtr, EmfType)

지정된 파일 이름, 디바이스 컨텍스트에 대한 창 핸들 및 Metafile의 형식을 지정하는 EmfType 열거형을 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(String, IntPtr, EmfType, String)

지정된 파일 이름, 디바이스 컨텍스트에 대한 창 핸들 및 Metafile의 형식을 지정하는 EmfType 열거형을 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다. 설명이 포함된 문자열을 추가할 수도 있습니다.

Metafile(String, IntPtr, Rectangle)

지정된 파일 이름, 디바이스 컨텍스트에 대한 창 핸들 및 새 Metafile을 제한하는 사각형을 나타내는 Rectangle 구조체를 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(String, IntPtr, Rectangle, MetafileFrameUnit)

지정된 파일 이름, 디바이스 컨텍스트에 대한 창 핸들, 새 Metafile을 제한하는 사각형을 나타내는 Rectangle 구조체 및 제공된 단위를 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(String, IntPtr, Rectangle, MetafileFrameUnit, EmfType)

지정된 파일 이름, 디바이스 컨텍스트에 대한 창 핸들, 새 Metafile을 제한하는 사각형을 나타내는 Rectangle 구조체, 제공된 단위 및 Metafile의 형식을 지정하는 EmfType 열거형을 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(String, IntPtr, Rectangle, MetafileFrameUnit, EmfType, String)

지정된 파일 이름, 디바이스 컨텍스트에 대한 창 핸들, 새 Metafile을 제한하는 사각형을 나타내는 Rectangle 구조체, 제공된 단위 및 Metafile의 형식을 지정하는 EmfType 열거형을 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다. 설명이 포함된 문자열을 추가할 수도 있습니다.

Metafile(String, IntPtr, Rectangle, MetafileFrameUnit, String)

지정된 파일 이름, 디바이스 컨텍스트에 대한 창 핸들, 새 Metafile을 제한하는 사각형을 나타내는 Rectangle 구조체 및 제공된 단위를 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다. 설명이 포함된 문자열을 추가할 수도 있습니다.

Metafile(String, IntPtr, RectangleF)

지정된 파일 이름, 디바이스 컨텍스트에 대한 창 핸들 및 새 Metafile을 제한하는 사각형을 나타내는 RectangleF 구조체를 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(String, IntPtr, RectangleF, MetafileFrameUnit)

지정된 파일 이름, 디바이스 컨텍스트에 대한 창 핸들, 새 Metafile을 제한하는 사각형을 나타내는 RectangleF 구조체 및 제공된 단위를 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(String, IntPtr, RectangleF, MetafileFrameUnit, EmfType)

지정된 파일 이름, 디바이스 컨텍스트에 대한 창 핸들, 새 Metafile을 제한하는 사각형을 나타내는 RectangleF 구조체, 제공된 단위 및 Metafile의 형식을 지정하는 EmfType 열거형을 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다.

Metafile(String, IntPtr, RectangleF, MetafileFrameUnit, EmfType, String)

지정된 파일 이름, 디바이스 컨텍스트에 대한 창 핸들, 새 Metafile을 제한하는 사각형을 나타내는 RectangleF 구조체, 제공된 단위 및 Metafile의 형식을 지정하는 EmfType 열거형을 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다. 설명이 포함된 문자열을 추가할 수도 있습니다.

Metafile(String, IntPtr, RectangleF, MetafileFrameUnit, String)

지정된 파일 이름, 디바이스 컨텍스트에 대한 창 핸들, 새 Metafile을 제한하는 사각형을 나타내는 RectangleF 구조체 및 제공된 단위를 사용하여 Metafile 클래스의 새 인스턴스를 초기화합니다. 설명이 포함된 문자열을 추가할 수도 있습니다.

속성

Flags

Image의 픽셀 데이터에 대한 특성 플래그를 가져옵니다.

(다음에서 상속됨 Image)
FrameDimensionsList

Image에 있는 프레임의 크기를 나타내는 GUID의 배열을 가져옵니다.

(다음에서 상속됨 Image)
Height

Image의 높이(픽셀)를 가져옵니다.

(다음에서 상속됨 Image)
HorizontalResolution

Image의 가로 해상도(인치 당 픽셀 수)를 가져옵니다.

(다음에서 상속됨 Image)
Palette

Image에 사용되는 색상표를 가져오거나 설정합니다.

(다음에서 상속됨 Image)
PhysicalDimension

이 이미지의 너비와 높이를 가져옵니다.

(다음에서 상속됨 Image)
PixelFormat

Image의 픽셀 형식을 가져옵니다.

(다음에서 상속됨 Image)
PropertyIdList

Image에 저장된 속성 항목의 ID를 가져옵니다.

(다음에서 상속됨 Image)
PropertyItems

Image에 저장된 모든 속성 항목(메타데이터)을 가져옵니다.

(다음에서 상속됨 Image)
RawFormat

Image의 파일 형식을 가져옵니다.

(다음에서 상속됨 Image)
Size

이 이미지의 너비와 높이를 픽셀로 가져옵니다.

(다음에서 상속됨 Image)
Tag

이미지에 대한 추가 데이터를 제공하는 개체를 가져오거나 설정합니다.

(다음에서 상속됨 Image)
VerticalResolution

Image의 세로 해상도(인치 당 픽셀 수)를 가져옵니다.

(다음에서 상속됨 Image)
Width

Image의 너비(픽셀)를 가져옵니다.

(다음에서 상속됨 Image)

메서드

Clone()

Image의 정확한 복사본을 만듭니다.

(다음에서 상속됨 Image)
CreateObjRef(Type)

원격 개체와 통신하는 데 사용되는 프록시 생성에 필요한 모든 관련 정보가 들어 있는 개체를 만듭니다.

(다음에서 상속됨 MarshalByRefObject)
Dispose()

Image에서 사용하는 리소스를 모두 해제합니다.

(다음에서 상속됨 Image)
Dispose(Boolean)

Image에서 사용하는 관리되지 않는 리소스를 해제하고, 관리되는 리소스를 선택적으로 해제할 수 있습니다.

(다음에서 상속됨 Image)
Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetBounds(GraphicsUnit)

지정된 단위로 이미지의 범위를 가져옵니다.

(다음에서 상속됨 Image)
GetEncoderParameterList(Guid)

지정된 이미지 인코더가 지원하는 매개 변수에 대한 정보를 반환합니다.

(다음에서 상속됨 Image)
GetFrameCount(FrameDimension)

지정된 크기의 프레임 수를 반환합니다.

(다음에서 상속됨 Image)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetHenhmetafile()

확장 Metafile에 대한 창 핸들을 반환합니다.

GetLifetimeService()
사용되지 않음.

이 인스턴스의 수명 정책을 제어하는 현재의 수명 서비스 개체를 검색합니다.

(다음에서 상속됨 MarshalByRefObject)
GetMetafileHeader()

MetafileHeader과 연결된 Metafile를 반환합니다.

GetMetafileHeader(IntPtr)

지정된 MetafileHeader와 관련된 Metafile를 반환합니다.

GetMetafileHeader(IntPtr, WmfPlaceableFileHeader)

지정된 MetafileHeader와 관련된 Metafile를 반환합니다.

GetMetafileHeader(Stream)

지정된 MetafileHeader와 관련된 Metafile를 반환합니다.

GetMetafileHeader(String)

지정된 MetafileHeader와 관련된 Metafile를 반환합니다.

GetPropertyItem(Int32)

지정된 속성 항목을 이 Image에서 가져옵니다.

(다음에서 상속됨 Image)
GetThumbnailImage(Int32, Int32, Image+GetThumbnailImageAbort, IntPtr)

Image의 축소판 그림을 반환합니다.

(다음에서 상속됨 Image)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
InitializeLifetimeService()
사용되지 않음.

이 인스턴스의 수명 정책을 제어하는 수명 서비스 개체를 가져옵니다.

(다음에서 상속됨 MarshalByRefObject)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
MemberwiseClone(Boolean)

현재 MarshalByRefObject 개체의 단순 복사본을 만듭니다.

(다음에서 상속됨 MarshalByRefObject)
PlayRecord(EmfPlusRecordType, Int32, Int32, Byte[])

개별 메타파일 레코드를 재생합니다.

RemovePropertyItem(Int32)

지정된 속성 항목을 이 Image에서 제거합니다.

(다음에서 상속됨 Image)
RotateFlip(RotateFlipType)

Image를 회전하거나, 대칭 이동하거나, 회전하여 대칭 이동합니다.

(다음에서 상속됨 Image)
Save(Stream, ImageCodecInfo, EncoderParameters)

지정된 인코더 및 이미지 인코더 매개 변수를 사용하여 이 이미지를 지정된 스트림에 저장합니다.

(다음에서 상속됨 Image)
Save(Stream, ImageFormat)

이 이미지를 지정된 형식의 지정된 스트림에 저장합니다.

(다음에서 상속됨 Image)
Save(String)

Image를 지정된 파일이나 스트림에 저장합니다.

(다음에서 상속됨 Image)
Save(String, ImageCodecInfo, EncoderParameters)

지정된 인코더 및 이미지 인코더 매개 변수를 사용하여 이 Image를 지정된 파일에 저장합니다.

(다음에서 상속됨 Image)
Save(String, ImageFormat)

Image를 지정된 형식으로 지정된 파일에 저장합니다.

(다음에서 상속됨 Image)
SaveAdd(EncoderParameters)

Save 메서드에 대한 이전 호출에 지정된 파일이나 스트림에 프레임을 추가합니다. 이 메서드를 사용하여 다중 프레임 이미지에서 선택한 프레임을 다른 다중 프레임 이미지에 저장합니다.

(다음에서 상속됨 Image)
SaveAdd(Image, EncoderParameters)

Save 메서드에 대한 이전 호출에 지정된 파일이나 스트림에 프레임을 추가합니다.

(다음에서 상속됨 Image)
SelectActiveFrame(FrameDimension, Int32)

크기와 인덱스로 지정한 프레임을 선택합니다.

(다음에서 상속됨 Image)
SetPropertyItem(PropertyItem)

Image에 속성 항목(메타데이터)을 저장합니다.

(다음에서 상속됨 Image)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

명시적 인터페이스 구현

ISerializable.GetObjectData(SerializationInfo, StreamingContext)

대상 개체를 직렬화하는 데 필요한 데이터로 SerializationInfo를 채웁니다.

(다음에서 상속됨 Image)

적용 대상