[Cannot post in comment... 1000 characters, ...]
Test .SVG copied to PictureBox from WebBrowser with IViewObject interface =>
Imports System.Runtime.InteropServices
Public Class Form1
<ComImport()>
<Guid("0000010d-0000-0000-C000-000000000046")>
<InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
Public Interface IViewObject
<PreserveSig>
Function Draw(dwDrawAspect As UInteger, lindex As Integer, pvAspect As IntPtr, ptd As IntPtr, hdcTargetDev As IntPtr, hdcDraw As IntPtr, lprcBounds As Rectangle,
lprcWBounds As IntPtr, pfnContinue As IntPtr, dwContinue As Integer) As Integer
Function GetColorSet(dwDrawAspect As UInteger, lindex As Integer, pvAspect As IntPtr, ptd As IntPtr, hicTargetDev As IntPtr, <Out> ppColorSet As IntPtr) As Integer
Function Freeze(dwDrawAspect As UInteger, lindex As Integer, pvAspect As IntPtr, <Out> pdwFreeze As UInteger) As Integer
Function Unfreeze(dwFreeze As UInteger) As Integer
Function SetAdvise(aspects As UInteger, advf As UInteger, pAdvSink As IntPtr) As Integer
Function GetAdvise(<Out> pAspects As UInteger, <Out> pAdvf As UInteger, <Out> ppAdvSink As IntPtr) As Integer
End Interface
Public Enum DVASPECT
DVASPECT_CONTENT = 1
DVASPECT_THUMBNAIL = 2
DVASPECT_ICON = 4
DVASPECT_DOCPRINT = 8
End Enum
Private Sub PictureBox1_Paint(sender As Object, e As PaintEventArgs) Handles PictureBox1.Paint
e.Graphics.DrawEllipse(New Pen(Color.Red, 2.0F), 50, 50, PictureBox1.Size.Width - 100, PictureBox1.Size.Height - 100)
End Sub
Friend WithEvents WebBrowser1 As WebBrowser
Friend WithEvents PictureBox1 As PictureBox
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
WebBrowser1 = New System.Windows.Forms.WebBrowser()
PictureBox1 = New System.Windows.Forms.PictureBox()
WebBrowser1.Location = New System.Drawing.Point(36, 68)
WebBrowser1.MinimumSize = New System.Drawing.Size(20, 20)
WebBrowser1.Name = "WebBrowser1"
WebBrowser1.Size = New System.Drawing.Size(500, 500)
WebBrowser1.ScrollBarsEnabled = False
WebBrowser1.Url = New Uri(String.Format("E:\Sources\VB_SVG\originalSvg.svg"))
WebBrowser1.Visible = False
PictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
PictureBox1.Location = New System.Drawing.Point(20, 20)
PictureBox1.Name = "PictureBox1"
PictureBox1.Size = New System.Drawing.Size(500, 500)
Controls.Add(PictureBox1)
Controls.Add(WebBrowser1)
Name = "Form1"
ClientSize = New System.Drawing.Size(540, 540)
CenterToScreen()
End Sub
Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
' Arbitrary size to test
Dim nWidth = 500
Dim nHeight = 500
Dim bmp = New Bitmap(nWidth, nHeight)
Dim gr As Graphics = Graphics.FromImage(bmp)
Dim hDC = gr.GetHdc()
Dim rc = New Rectangle(0, 0, nWidth, nHeight)
Dim viewObject = CType(WebBrowser1.Document.DomDocument, IViewObject)
viewObject.Draw(DVASPECT.DVASPECT_CONTENT, -1, CType(0, IntPtr), CType(0, IntPtr), CType(0, IntPtr), hDC, rc, CType(0, IntPtr), CType(0, IntPtr), 0)
gr.ReleaseHdc(hDC)
PictureBox1.Image = bmp
End Sub
End Class