Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hyperlink inside a WinForms Label

Tags:

c#

winforms

label

For example, the About dialogue of Notepad has only "Microsoft Software Licence Terms" as a hyperlink but the rest of the text is not. How can I achieve similar result with the Label (or Labels) of WinForms?

I can use two labels, one Label and another LinkLabel, but then the two will not be concatenated naturally (the width of labels may vary by the system font face or the language).

enter image description here

like image 846
Damn Vegetables Avatar asked Mar 06 '17 04:03

Damn Vegetables


People also ask

How do you hyperlink a Label?

In order to add a hyperlink, we can bind the label text with a button that makes it clickable. The open_new(url) method is used to define the function that opens a web browser to follow the link.

What is link Label?

A LinkLabel control is a label control that can display a hyperlink. A LinkLabel control is inherited from the Label class so it has all the functionality provided by the Windows Forms Label control. LinkLabel control does not participate in user input or capture mouse or keyboard events.

What is link label control?

The Windows Forms LinkLabel control enables you to add Web-style links to Windows Forms applications. You can use the LinkLabel control for everything that you can use the Label control for; you can also set part of the text as a link to an object or Web page.


1 Answers

You could use a LinkLabel, then set the LinkArea property. This should highlight the link you want and will also be the only clickable part.

Properties > LinkArea > ... button then just highlight the text part you want as a link

like image 176
P. Pat Avatar answered Oct 20 '22 13:10

P. Pat