如何在C#中单击按钮添加超链接? [英] How to add a hyper link on click of a button in C#?

查看:351
本文介绍了如何在C#中单击按钮添加超链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有按钮,所以当我点击它时,我想显示一个网页例如



when我点击按钮,它应该打开谷歌主页



所以我如何添加www.google.com超链接到按钮?



请有人能为我提供C#解决方案吗?

Hi,
I have button, so when i click on it, i want to display a web page for example

when i hit the button , it should open google home page

so how do i add www.google.com hyperlink to the button?

please can anyone provide me a solution in C#?

推荐答案

最简单的方法是在按钮上添加以下内容 OnClick 处理程序:

The simplest way is adding the following to your button OnClick handler:
Process.Start("http://www.google.com");






添加属性NavigateUri如下所述:



Hi,

Add attribute "NavigateUri" as stated below :

<HyperlinkButton Name="MyHyperlink" ClickMode="Press" Content="AutoCompleteBox"   Foreground="Blue" FontFamily="Arial" FontSize="15" NavigateUri="http:\\www.google.com">
</HyperlinkButton>





谢谢,

Bh @gyesh



Thanks,
Bh@gyesh


这篇关于如何在C#中单击按钮添加超链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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