我们需要能够从我们的应用程序(.NetStandard 2.0)中打开一个Web浏览器。浏览器应该作为一个外部应用程序打开,需求并不要求将浏览器嵌入到我们的应用程序中,因此使用WebBroswer控件不是一个选项。我们需要能够指定以下选项。
我们最初认为使用Process类就可以了,但似乎这些选项不能用Process类来指定。如果有任何关于如何实现这一功能的文章或建议,我们将非常感激。
你可以考虑创建一个Windows Form应用程序或 WPF应用,然后使用 WebBrowser控件 来显示网页。
关于WebBrowser控件的详细使用方法,请查看以下链接。
尽量使用 InternetExplorer对象 来控制Windows Internet Explorer的实例。
首先,右击应用程序 参考资料 并选择 添加参考资料 选项,然后在 COM 选项卡,检查了 微软互联网控制 并点击 好的 来添加引用。
然后,参考下面的代码来使用InternetExplorer对象。
SHDocVw.InternetExplorer ie = new SHDocVw.InternetExplorer();
ie.Navigate("http://www.bing.com");
ie.ToolBar = 0; //hide or display the toolbar.
ie.AddressBar = false; //hide or display the AddressBar.
ie.Left = 200;
ie.Height = 800;
ie.Width = 500;
ie.StatusBar = false; // hide or display the statusBar.
ie.Visible = true; //display IE browser.
更多关于属性的详细信息,请查看《InternetExplorer》中的 IWebBrowser2接口.