<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net_Tutorial%2F2D_Graphics%2FMetaFile_WMF</id>
		<title>VB.Net Tutorial/2D Graphics/MetaFile WMF - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net_Tutorial%2F2D_Graphics%2FMetaFile_WMF"/>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net_Tutorial/2D_Graphics/MetaFile_WMF&amp;action=history"/>
		<updated>2026-04-05T19:06:38Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net_Tutorial/2D_Graphics/MetaFile_WMF&amp;diff=3255&amp;oldid=prev</id>
		<title> в 16:40, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net_Tutorial/2D_Graphics/MetaFile_WMF&amp;diff=3255&amp;oldid=prev"/>
				<updated>2010-05-26T16:40:30Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 16:40, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net_Tutorial/2D_Graphics/MetaFile_WMF&amp;diff=3256&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net_Tutorial/2D_Graphics/MetaFile_WMF&amp;diff=3256&amp;oldid=prev"/>
				<updated>2010-05-26T12:54:43Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Create a Metafile==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;Imports System.Drawing.Imaging&lt;br /&gt;
Imports System.Drawing&lt;br /&gt;
Imports System.Drawing.Drawing2D&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
public class MetafileHeaderInfo&lt;br /&gt;
   public Shared Sub Main&lt;br /&gt;
        Application.Run(New Form1)&lt;br /&gt;
   End Sub&lt;br /&gt;
End class&lt;br /&gt;
public class Form1&lt;br /&gt;
  Inherits System.Windows.Forms.Form&lt;br /&gt;
  Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)&lt;br /&gt;
        Dim g As Graphics = Me.CreateGraphics()&lt;br /&gt;
        Dim hdc As IntPtr = g.GetHdc()&lt;br /&gt;
        Dim rect As New Rectangle(20, 20, 200, 100)&lt;br /&gt;
        Dim curMetafile As New Metafile(hdc, EmfType.EmfPlusDual, &amp;quot;yourfile.emf&amp;quot;)&lt;br /&gt;
        Dim g1 As Graphics = Graphics.FromImage(curMetafile) &amp;quot;&lt;br /&gt;
        g1.SmoothingMode = SmoothingMode.HighQuality&lt;br /&gt;
        g1.FillRectangle(Brushes.Red, rect)&lt;br /&gt;
        rect.Y += 110&lt;br /&gt;
        g1.DrawEllipse(New Pen(Brushes.Green, 3), rect)&lt;br /&gt;
        g1.DrawLine(Pens.Blue, New Point(20, 20), New Point(400, 200))&lt;br /&gt;
        &amp;quot;Release objects&lt;br /&gt;
        g.ReleaseHdc(hdc)&lt;br /&gt;
        g1.Dispose()&lt;br /&gt;
        g.Dispose()&lt;br /&gt;
  End Sub&lt;br /&gt;
  Public Sub New()&lt;br /&gt;
   &lt;br /&gt;
    MyBase.New()&lt;br /&gt;
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)&lt;br /&gt;
    Me.ClientSize = New System.Drawing.Size(292, 273)&lt;br /&gt;
    Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen&lt;br /&gt;
  End Sub&lt;br /&gt;
End Class&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Draw a meta wmf file==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;Imports System.Drawing&lt;br /&gt;
Imports System.Drawing.Drawing2D&lt;br /&gt;
Imports System.Drawing.Imaging&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
public class MetafileDraw&lt;br /&gt;
   public Shared Sub Main&lt;br /&gt;
        Application.Run(New Form1)&lt;br /&gt;
   End Sub&lt;br /&gt;
End class&lt;br /&gt;
public class Form1&lt;br /&gt;
  Inherits System.Windows.Forms.Form&lt;br /&gt;
  Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)&lt;br /&gt;
        Dim g As Graphics = Me.CreateGraphics()&lt;br /&gt;
        g.Clear(Me.BackColor)&lt;br /&gt;
        Dim curMetafile As New Metafile(&amp;quot;yourfile.wmf&amp;quot;)&lt;br /&gt;
        g.DrawImage(curMetafile, 0, 0)&lt;br /&gt;
        g.Dispose()&lt;br /&gt;
  End Sub&lt;br /&gt;
  Public Sub New()&lt;br /&gt;
   &lt;br /&gt;
    MyBase.New()&lt;br /&gt;
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)&lt;br /&gt;
    Me.ClientSize = New System.Drawing.Size(292, 273)&lt;br /&gt;
    Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen&lt;br /&gt;
  End Sub&lt;br /&gt;
End Class&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Draw on a wmf file==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;Imports System.Drawing.Imaging&lt;br /&gt;
Imports System.Drawing&lt;br /&gt;
Imports System.Drawing.Drawing2D&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
public class DrawOnWMFFile&lt;br /&gt;
   public Shared Sub Main&lt;br /&gt;
        Application.Run(New Form1)&lt;br /&gt;
   End Sub&lt;br /&gt;
End class&lt;br /&gt;
public class Form1&lt;br /&gt;
  Inherits System.Windows.Forms.Form&lt;br /&gt;
  Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)&lt;br /&gt;
        Dim curMetafile As Metafile = Nothing&lt;br /&gt;
        Dim g As Graphics = Me.CreateGraphics()&lt;br /&gt;
        Dim hdc As IntPtr = g.GetHdc()&lt;br /&gt;
        Dim rect As New Rectangle(0, 0, 200, 200)&lt;br /&gt;
        curMetafile = New Metafile(&amp;quot;newFile.wmf&amp;quot;, hdc)&lt;br /&gt;
&lt;br /&gt;
        Dim g1 As Graphics = Graphics.FromImage(curMetafile)&lt;br /&gt;
        g1.SmoothingMode = SmoothingMode.HighQuality&lt;br /&gt;
        g1.FillRectangle(Brushes.Green, rect)&lt;br /&gt;
        rect.Y += 110&lt;br /&gt;
        Dim lgBrush As New LinearGradientBrush(rect, Color.Red, Color.Blue, 45.0F)&lt;br /&gt;
        g1.FillEllipse(lgBrush, rect)&lt;br /&gt;
        rect.Y += 110&lt;br /&gt;
        g1.DrawString(&amp;quot;MetaFile Sample&amp;quot;, New Font(&amp;quot;Verdana&amp;quot;, 20), lgBrush, 200, 200, StringFormat.GenericTypographic)&lt;br /&gt;
        g.ReleaseHdc(hdc)&lt;br /&gt;
        g1.Dispose()&lt;br /&gt;
        g.Dispose()&lt;br /&gt;
  End Sub&lt;br /&gt;
  Public Sub New()&lt;br /&gt;
   &lt;br /&gt;
    MyBase.New()&lt;br /&gt;
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)&lt;br /&gt;
    Me.ClientSize = New System.Drawing.Size(292, 273)&lt;br /&gt;
    Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen&lt;br /&gt;
  End Sub&lt;br /&gt;
End Class&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Make Metafile (WMF)==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;Imports System.Drawing.Imaging&lt;br /&gt;
Imports System.Drawing&lt;br /&gt;
Imports System.Drawing.Drawing2D&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
Imports System.Math&lt;br /&gt;
public class WMFFileCreate&lt;br /&gt;
   public Shared Sub Main&lt;br /&gt;
        Application.Run(New Form1)&lt;br /&gt;
   End Sub&lt;br /&gt;
End class&lt;br /&gt;
&lt;br /&gt;
Public Class Form1&lt;br /&gt;
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load&lt;br /&gt;
        Const WID As Integer = 200&lt;br /&gt;
        Dim file_name As String = &amp;quot;test.wmf&amp;quot;&lt;br /&gt;
        Dim me_gr As Graphics = Me.CreateGraphics&lt;br /&gt;
        Dim me_hdc As IntPtr = me_gr.GetHdc&lt;br /&gt;
        Dim bounds As New RectangleF(0, 0, WID, WID)&lt;br /&gt;
        Dim mf As New Metafile(file_name, me_hdc, bounds, MetafileFrameUnit.Pixel)&lt;br /&gt;
        me_gr.ReleaseHdc(me_hdc)&lt;br /&gt;
        Dim gr As Graphics = Graphics.FromImage(mf)&lt;br /&gt;
        gr.PageUnit = GraphicsUnit.Pixel&lt;br /&gt;
        gr.Clear(Color.White)&lt;br /&gt;
        gr.DrawEllipse(Pens.Red, bounds)&lt;br /&gt;
        gr.DrawLine(Pens.Blue, 0, 0, WID, WID)&lt;br /&gt;
        gr.DrawLine(Pens.Blue, WID, 0, 0, WID)&lt;br /&gt;
        gr.Dispose()&lt;br /&gt;
        mf.Dispose()&lt;br /&gt;
        mf = New Metafile(file_name)&lt;br /&gt;
        Dim bm As New Bitmap(WID, WID)&lt;br /&gt;
        gr = Graphics.FromImage(bm)&lt;br /&gt;
        Dim dest_bounds As New RectangleF(0, 0, WID, WID)&lt;br /&gt;
        Dim source_bounds As New RectangleF(0, 0, WID + 1, WID + 1)&lt;br /&gt;
        gr.DrawImage(mf, bounds, source_bounds, GraphicsUnit.Pixel)&lt;br /&gt;
        picOrig.SizeMode = PictureBoxSizeMode.AutoSize&lt;br /&gt;
        picOrig.Image = bm&lt;br /&gt;
        gr.Dispose()&lt;br /&gt;
        mf.Dispose()&lt;br /&gt;
        mf = New Metafile(file_name)&lt;br /&gt;
        picSmall.SetBounds(picOrig.Right + 10, picOrig.Top,picOrig.Width \ 2, picOrig.Height \ 2)&lt;br /&gt;
        bm = New Bitmap(picSmall.ClientSize.Width,picSmall.ClientSize.Height)&lt;br /&gt;
        gr = Graphics.FromImage(bm)&lt;br /&gt;
        gr.ScaleTransform(0.5, 0.5)&lt;br /&gt;
        gr.DrawImage(mf, bounds, source_bounds, GraphicsUnit.Pixel)&lt;br /&gt;
        picSmall.Image = bm&lt;br /&gt;
        gr.Dispose()&lt;br /&gt;
        mf.Dispose()&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
&amp;lt;Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()&amp;gt; _&lt;br /&gt;
Partial Public Class Form1&lt;br /&gt;
    Inherits System.Windows.Forms.Form&lt;br /&gt;
    &amp;quot;Form overrides dispose to clean up the component list.&lt;br /&gt;
    &amp;lt;System.Diagnostics.DebuggerNonUserCode()&amp;gt; _&lt;br /&gt;
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)&lt;br /&gt;
        If disposing AndAlso components IsNot Nothing Then&lt;br /&gt;
            components.Dispose()&lt;br /&gt;
        End If&lt;br /&gt;
        MyBase.Dispose(disposing)&lt;br /&gt;
    End Sub&lt;br /&gt;
    &amp;quot;Required by the Windows Form Designer&lt;br /&gt;
    Private components As System.ruponentModel.IContainer&lt;br /&gt;
    &amp;quot;NOTE: The following procedure is required by the Windows Form Designer&lt;br /&gt;
    &amp;quot;It can be modified using the Windows Form Designer.  &lt;br /&gt;
    &amp;quot;Do not modify it using the code editor.&lt;br /&gt;
    &amp;lt;System.Diagnostics.DebuggerStepThrough()&amp;gt; _&lt;br /&gt;
    Private Sub InitializeComponent()&lt;br /&gt;
        Me.picSmall = New System.Windows.Forms.PictureBox&lt;br /&gt;
        Me.picOrig = New System.Windows.Forms.PictureBox&lt;br /&gt;
        CType(Me.picSmall, System.ruponentModel.ISupportInitialize).BeginInit()&lt;br /&gt;
        CType(Me.picOrig, System.ruponentModel.ISupportInitialize).BeginInit()&lt;br /&gt;
        Me.SuspendLayout()&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;picSmall&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.picSmall.Location = New System.Drawing.Point(64, 8)&lt;br /&gt;
        Me.picSmall.Name = &amp;quot;picSmall&amp;quot;&lt;br /&gt;
        Me.picSmall.Size = New System.Drawing.Size(32, 24)&lt;br /&gt;
        Me.picSmall.TabIndex = 3&lt;br /&gt;
        Me.picSmall.TabStop = False&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;picOrig&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.picOrig.Location = New System.Drawing.Point(8, 8)&lt;br /&gt;
        Me.picOrig.Name = &amp;quot;picOrig&amp;quot;&lt;br /&gt;
        Me.picOrig.Size = New System.Drawing.Size(48, 56)&lt;br /&gt;
        Me.picOrig.TabIndex = 2&lt;br /&gt;
        Me.picOrig.TabStop = False&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Form1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)&lt;br /&gt;
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font&lt;br /&gt;
        Me.ClientSize = New System.Drawing.Size(326, 215)&lt;br /&gt;
        Me.Controls.Add(Me.picSmall)&lt;br /&gt;
        Me.Controls.Add(Me.picOrig)&lt;br /&gt;
        Me.Name = &amp;quot;Form1&amp;quot;&lt;br /&gt;
        Me.Text = &amp;quot;MakeMetafile&amp;quot;&lt;br /&gt;
        CType(Me.picSmall, System.ruponentModel.ISupportInitialize).EndInit()&lt;br /&gt;
        CType(Me.picOrig, System.ruponentModel.ISupportInitialize).EndInit()&lt;br /&gt;
        Me.ResumeLayout(False)&lt;br /&gt;
    End Sub&lt;br /&gt;
    Friend WithEvents picSmall As System.Windows.Forms.PictureBox&lt;br /&gt;
    Friend WithEvents picOrig As System.Windows.Forms.PictureBox&lt;br /&gt;
End Class&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set EnumerateMetafileProc property==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;Imports System.Drawing&lt;br /&gt;
Imports System.Drawing.Imaging&lt;br /&gt;
Imports System.Drawing.Drawing2D&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
public class EnumerateMetafileProc&lt;br /&gt;
   public Shared Sub Main&lt;br /&gt;
        Application.Run(New Form1)&lt;br /&gt;
   End Sub&lt;br /&gt;
End class&lt;br /&gt;
public class Form1&lt;br /&gt;
  Inherits System.Windows.Forms.Form&lt;br /&gt;
  Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)&lt;br /&gt;
        Dim g As Graphics = Me.CreateGraphics()&lt;br /&gt;
        g.Clear(Me.BackColor)&lt;br /&gt;
        Dim curMetafile As New Metafile(&amp;quot;mtfile.wmf&amp;quot;)&lt;br /&gt;
        Dim enumMetaCB1 As New Graphics.EnumerateMetafileProc(AddressOf EnumMetaCB)&lt;br /&gt;
        g.EnumerateMetafile(curMetafile, New Point(0, 0), EnumMetaCB1)&lt;br /&gt;
        curMetafile.Dispose()&lt;br /&gt;
        g.Dispose()&lt;br /&gt;
  End Sub&lt;br /&gt;
    Private Function EnumMetaCB(ByVal recordType As EmfPlusRecordType, ByVal flags As Integer, ByVal dataSize As Integer, ByVal data As IntPtr, ByVal callbackData As PlayRecordCallback) As Boolean &amp;quot;&lt;br /&gt;
        Dim str As String = &amp;quot;&amp;quot;&lt;br /&gt;
        &amp;quot; Play only EmfPlusRecordType.FillEllipse records.&lt;br /&gt;
        If recordType = EmfPlusRecordType.FillEllipse Or recordType = EmfPlusRecordType.FillRects Or recordType = EmfPlusRecordType.DrawEllipse Or recordType = EmfPlusRecordType.DrawRects Then&lt;br /&gt;
            str = &amp;quot;Record type:&amp;quot; + recordType.ToString() + &amp;quot;, Flags:&amp;quot; + flags.ToString() + &amp;quot;, DataSize:&amp;quot; + dataSize.ToString() + &amp;quot;, Data:&amp;quot; + data.ToString()&lt;br /&gt;
            MessageBox.Show(str)&lt;br /&gt;
        End If&lt;br /&gt;
        Return True&lt;br /&gt;
    End Function &amp;quot;EnumMetaCB&lt;br /&gt;
  Public Sub New()&lt;br /&gt;
   &lt;br /&gt;
    MyBase.New()&lt;br /&gt;
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)&lt;br /&gt;
    Me.ClientSize = New System.Drawing.Size(292, 273)&lt;br /&gt;
    Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen&lt;br /&gt;
  End Sub&lt;br /&gt;
End Class&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>