如何打开在C#中的默认浏览器 [英] How to open in default browser in C#

查看:177
本文介绍了如何打开在C#中的默认浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设计的小C#应用程序并且在其网络浏览器。目前,我有我所有的我的电脑上的默认值说谷歌浏览器为默认浏览器,但是当我点击我的应用程序在新窗口中打开链接,它会打开IE浏览器。有没有什么办法让这些链接在默认浏览器,而不是开放的?还是有我的电脑出问题了吗?

I am designing a small C# application and there is a web browser in it. I currently have all of my defaults on my computer say google chrome is my default browser, yet when I click a link in my application to open in a new window, it opens internet explorer. Is there any way to make these links open in the default browser instead? Or is there something wrong on my computer?

我的问题是,我在应用程序的浏览器,所以说,你去谷歌,键入堆栈溢出,然后右键单击第一个链接,然后点击在新窗口中打开,它在IE,而不是浏览器中打开。这是不是我有codeD不当,或者是有一个设置不是我的电脑

My problem is that I have a webbrowser in the application, so say you go to google and type in "stack overflow" and right click the first link and click "Open in new window" it opens in IE instead of Chrome. Is this something I have coded improperly, or is there a setting not correct on my computer

===编辑===

这实在是烦人。我已经知道,浏览器是IE,但我之前工作的罚款。当我点击一个链接它在Chrome中打开。我是用锋利的发展,使当时的应用程序,因为我无法让C#的前preSS启动。我做了一个新的Windows安装,因为我不是太远沿着我的申请,我决定从头开始,现在我有这个问题。这就是为什么我不知道这是否是我的计算机或没有。为什么IE浏览器启动时,点击一个链接,而不是简单地打开在默认浏览器的新链接整个浏览器?

This is really annoying. I am already aware that the browser is IE, but I had it working fine before. When I clicked a link it opened in chrome. I was using sharp develop to make the application at that time because I could not get c# express to start up. I did a fresh windows install and since I wasn't too far along in my application, I decided to start over, and now I am having this problem. That is why I am not sure if it is my computer or not. Why would IE start up the whole browser when a link is clicked rather than simply opening the new link in the default browser?

推荐答案

您可以只写

System.Diagnostics.Process.Start("http://google.com");

修改:在 web浏览器控件是IE的一个嵌入式副本结果。
因此,它里面的所有链接将在IE中打开。

EDIT: The WebBrowser control is an embedded copy of IE.
Therefore, any links inside of it will open in IE.

要改变这种行为,您可以处理导航事件。

To change this behavior, you can handle the Navigating event.

这篇关于如何打开在C#中的默认浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆