views:

1080

answers:

2

How to do this?

A: 
 public IHTMLDocument2 Document
 {
     get
     {
           return webBrowser.Document as IHTMLDocument2;
     }
 }
...
Document.execCommand("FontSize", false, doubleValue.ToString())

This shold help

ArsenMkrt
A: 

Right way for WPF:

using mshtml; //reference to COM object "Microsoft HTML Object Library"

...

var doc = web.Document as HTMLDocument;
if (doc != null)
{
doc.execCommand("SelectAll", false, null);
doc.execCommand("FontSize", false, 5);
doc.execCommand("Unselect", false, null);
}

additional information - http://msdn.microsoft.com/en-us/library/ms533049(VS.85).aspx

dmach
This won't work in Vista. Microsoft has removed support for MSHTML in Vista and above.
eriawan
I tested it in Vista and it work properly.
dmach