wpf: change font size for WebBrowser control

你。 提交于 2020-06-18 11:58:45

问题


How to do this?


回答1:


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

This shold help




回答2:


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



来源:https://stackoverflow.com/questions/1119055/wpf-change-font-size-for-webbrowser-control

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!