How can I resize the text inside the WebBrowser control
-
martedì 20 marzo 2012 02:01
Hi, when using IE you can hold the Ctrl button and use the mouse wheel to resize.
But this does not work when using a Silverlight Out-Of-Browser WebBrowser control,
is there any way to get around this.By the way, I could not find the Silverlight link on the page, so I chose WPF group.
- Spostato Sheldon _Xiao martedì 3 aprile 2012 11:20 (From:Windows Presentation Foundation (WPF))
Tutte le risposte
-
martedì 20 marzo 2012 03:39
I have not tested this code but give it a try:
public static partial class WBExtensions { public static void SetZoom(this System.Windows.Controls.WebBrowser WebBrowser1, double Zoom) { // For this code to work: add the Microsoft.mshtml .NET reference mshtml.IHTMLDocument2 doc = WebBrowser1.Document as mshtml.IHTMLDocument2; doc.parentWindow.execScript("document.body.style.zoom=" + Zoom.ToString().Replace(",", ".") + ";"); } }
So you would have to capture the CTL wheel gesture, and call this extension method.JP Cowboy Coders Unite!
-
martedì 20 marzo 2012 06:27
There is no .Document in the Silverlight WebBrowser.
I was hoping there was a property somewhere I could turn on, maybe in the registry.
I will use JavaScript and call it from the out of browser application.
-
martedì 20 marzo 2012 12:45
Oh yes I forgot, welcome to the Misery of Silverlight. In their wisdom they decided not to give access in Silverlight to the DOM. That may have changed a bit with 5.0.. But get this, you CAN access it in Javascript on same page. You are better off posting this over in Silverlight forums.
JP Cowboy Coders Unite!
- Modificato Mr. Javaman II martedì 20 marzo 2012 12:45
-
mercoledì 21 marzo 2012 03:53
Hi TSD - NZ,
Sorry for my limit knowledge of Silverlight, this is WPF forum, as for Silverlight issue, I suggest you post it on silverlight forum to get the solution, there are many Silverlight experts active in that forum, the link is:
http://forums.silverlight.net/
Beat regards,
Sheldon _Xiao[MSFT]
MSDN Community Support | Feedback to us
Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

