The Windows Forms LinkLabel
control enables you to add Web-style links to Windows Forms applications. We can use the LinkLabel
control for everything that we can use the Label control for; we also can set part of the text as a link to an object or Web page.
The LinkLabel control has properties for hyperlinks and link colors in addition to all the Label control properties, methods, and events. The LinkArea
property sets the area of the text that activates the link. The LinkColor
, VisitedLinkColor
, and ActiveLinkColor
properties set the colors of the link. The LinkClicked
event determines what happens when the link text is selected.
The easiest way to use the LinkLabel control is to display a single link using the LinkArea
property, but using the Links
property we can also display multiple hyperlinks.The Links property enables us to access a collection of links. We can also specify data in the LinkData property of each individual LinkLabel.Link
object. The value of the LinkData
property can be used to store a display file's location or a website's address.