is there example webbrowser control displays svg files , may zoomed mouse wheel?
here simple form doing this:
public class form1 inherits form private mzoomfactor short = 100 private sub initializecomponent() me.webbrowser1 = new system.windows.forms.webbrowser() me.webbrowser1.dock = system.windows.forms.dockstyle.fill me.controls.add(me.webbrowser1) end sub friend withevents webbrowser1 system.windows.forms.webbrowser public sub new() ' call required designer. initializecomponent() webbrowser1.documenttext = "<!doctype html><html><head><meta http-equiv=""x-ua-compatible"" content=""ie=9""/></head><body><h1>my first svg</h1><svg width=""100"" height=""100""> <circle cx=""50"" cy=""50"" r=""40"" stroke=""green"" stroke-width=""4"" fill=""yellow"" /> sorry, browser not support inline svg.</svg></body></html>" end sub private sub form1_load(sender system.object, e system.eventargs) handles mybase.load 'these 2 statements needed, mousewheel event when control key pressed. windowstate = formwindowstate.normal webbrowser1.focus() end sub private sub form1_mousewheel(sender object, e system.windows.forms.mouseeventargs) handles me.mousewheel if modifierkeys = keys.control andalso e.delta <> 0 mzoomfactor += e.delta / 120 mzoomfactor = math.max(1, mzoomfactor) mzoomfactor = math.min(1000, mzoomfactor) webbrowser1.document.body.style = "zoom:" & mzoomfactor & "%" end if end sub end class
for svg displayed, ie9 must installed , following fragment must included in head of html:
<meta http-equiv="x-ua-compatible" content="ie=9"/>
for webbrowser control mousewheel event, when control key pressed following 2 statements must included in form_load handler:
windowstate = formwindowstate.normal webbrowser1.focus()
Comments
Post a Comment