What functional differences exist between WPF and WinForms WebBrowser control?

前端 未结 2 1395
小鲜肉
小鲜肉 2021-02-13 17:35

WPF WebBrowser control looks great but knowledge accumlated over time about WinForms WebBrowser is substantial and it\'s hard to ignore work like csExWB. It would be nice to kno

相关标签:
2条回答
  • 2021-02-13 18:26

    From one full day of frustration with wpf's component, here's what I discovered. Apparently, winforms webbrowser exposes much more methods and properties. For instance, there's no IsWebBrowserContextMenuEnabled, ActiveXInstance, etc. in wpf webbrowser.

    Also, the document property of each contains different types of objects. Winform contains a document of type System.Windows.Forms.HtmlDocument with a few interesting methods and properties like PointToClient and GetElementFromPoint. Wpf webbrowser document is an Object type document that can be cast to mshtml.HtmlDocument, which only provides the same methods and properties available from a standard html + javascript document. Not very exciting. I don't know if it can be cast to something else (useful that is) since there's no real documentation about it.

    The only disadvantage I could notice about winforms webbrowser is that the buttons and scrollbars inside the component don't have the same appearance as the wpf native controls.

    0 讨论(0)
  • 2021-02-13 18:29

    I must admit I don't know the differences, but if you hit problems you could perhaps use WindowsFormsHost to host the winform version in WPF, like so? Ultimately, both is a wrapper around shdocvw, so principles like "pure WPF" don't really apply.

    0 讨论(0)
提交回复
热议问题