Metafile.PlayRecord-Methode
Gibt einen einzelnen Metadateidatensatz wieder.
Namespace: System.Drawing.Imaging
Assembly: System.Drawing (in system.drawing.dll)
Syntax
'Declaration
Public Sub PlayRecord ( _
recordType As EmfPlusRecordType, _
flags As Integer, _
dataSize As Integer, _
data As Byte() _
)
'Usage
Dim instance As Metafile
Dim recordType As EmfPlusRecordType
Dim flags As Integer
Dim dataSize As Integer
Dim data As Byte()
instance.PlayRecord(recordType, flags, dataSize, data)
public void PlayRecord (
EmfPlusRecordType recordType,
int flags,
int dataSize,
byte[] data
)
public:
void PlayRecord (
EmfPlusRecordType recordType,
int flags,
int dataSize,
array<unsigned char>^ data
)
public void PlayRecord (
EmfPlusRecordType recordType,
int flags,
int dataSize,
byte[] data
)
public function PlayRecord (
recordType : EmfPlusRecordType,
flags : int,
dataSize : int,
data : byte[]
)
Parameter
- recordType
Element von EmfPlusRecordType, das den Typ des wiedergegebenen Metadateidatensatzes angibt.
- flags
Ein Satz von Flags, die Attribute des Datensatzes angeben.
- dataSize
Die Anzahl von Bytes in den Daten des Datensatzes.
- data
Ein Bytearray, das die Daten des Datensatzes enthält.
Beispiel
Im folgenden Codebeispiel wird die Verwendung der PlayRecord-Methode veranschaulicht.
Imports System
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
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());
}
}
Plattformen
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
Metafile-Klasse
Metafile-Member
System.Drawing.Imaging-Namespace