How to show hyperlink inside AboutBox description field
1 answer
Here you can use the WinForms control to achieve the desired result: LinkLabel
.
Just add it to your AboutBox layout and double click it. A handler will be created for the LinkClicked event and then you can use Process.Start
to open your website url.
public AboutBox1()
{
InitializeComponent();
this.Text = String.Format("About {0}", AssemblyTitle);
this.labelProductName.Text = AssemblyProduct;
this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion);
this.labelCopyright.Text = AssemblyCopyright;
this.labelCompanyName.Text = AssemblyCompany;
this.textBoxDescription.Text = AssemblyDescription;
this.Link.Text = "Visit our website!";
this.Link.Tag = WpfApplication2.Properties.Resources.website;
}
private void Link_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start((sender as LinkLabel).Tag.ToString());
}
In my case, I saved the URL as an application resource. And I showed this separately from the assembly description.
If you want the link to appear inside the assembly description, this is pretty tricky ...
+4
source to share