Windows Control: The Link Label
In the past, to add an internet or email link to a form, there were many steps to follow. As the internet and email had become an integral part of the…
Introduction#
In the past, incorporating web or email links into forms required several steps. Given the importance of the internet and email, a specialized control was developed. This led to the creation of the LinkLabel in the .NET Framework, while keeping the original behavior intact.
Characteristics of the Link Label#
As its name indicates, the LinkLabel control allows you to create a link. If you have done web development, you would know that a link can more readily be made fancy by varying its colors. A link typically uses three different colors (actually, if you use cascading style sheet, you can add a fourth color as hover): while keeping the original behavior intact.
- Link: This is the general color used on a link that a user has not clicked before. The LinkLabel class defines this color through the LinkColor property.
- Active Link: When the user clicks a link, its target typically opens if everything is alright. This causes the link to change its color status. The color of an active link is represented in the LinkLabel class with the ActiveLinkColor property.
- Visited: When a user comes to a page or the document that provides a link, you can indicate whether the link was previously accessed or not. This is done by displaying a color other than the link color. The color of a previously visited link is represented in the LinkLabel class by the VisitedLinkColor property.
After a link is set up, you can define its visual response to user interaction, like toggling underlines on mouseover. The LinkBehavior property controls these effects with values such as AlwaysUnderline, HoverUnderline, or NeverUnderline, or by deferring to the Control Panel's Internet Options. While links typically guide users to new content, they can be disabled if necessary. You can use the DisabledLinkColor property to customize the appearance of a deactivated link. The following code demonstrates this:
private void linkLabel1_LinkClicked(object sender,
LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start(
@"C:\Program Files\Internet Explorer\iexplore.exe",
"http://www.functionx.com/vccli");
}Home Copyright © 2008 C# Key

