Imports System.Drawing.Imaging
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
public class MetafileHeaderInfo
public Shared Sub Main
Application.Run(New Form1)
End Sub
End class
public class Form1
Inherits System.Windows.Forms.Form
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim g As Graphics = Me.CreateGraphics()
Dim hdc As IntPtr = g.GetHdc()
Dim rect As New Rectangle(20, 20, 200, 100)
Dim curMetafile As New Metafile(hdc, EmfType.EmfPlusDual, "yourfile.emf")
Dim g1 As Graphics = Graphics.FromImage(curMetafile) '
g1.SmoothingMode = SmoothingMode.HighQuality
g1.FillRectangle(Brushes.Red, rect)
rect.Y += 110
g1.DrawEllipse(New Pen(Brushes.Green, 3), rect)
g1.DrawLine(Pens.Blue, New Point(20, 20), New Point(400, 200))
'Release objects
g.ReleaseHdc(hdc)
g1.Dispose()
g.Dispose()
End Sub
Public Sub New()
MyBase.New()
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
End Sub
End Class