|
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 culture, it was also time to have an appropriate
control adapted for this need. To address this issue, a control called
LinkLabel is available from the .NET Framework.
|
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 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):
- 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 creating a link, when the user accesses it, you
can define some behavior the link would exhibit to the user, such as
getting underlined or not underlined when the mouse passes over the link.
The behaviors of a link can be controlled through the LinkBehavior
property whose values are AlwaysUnderline, HoverUnderline,
NeverUnderline, or the application would refer to Internet Options
dialog box of Control Panel.
A link is typically meant to help the user switch to a
different page or document when clicked. In some cases and at a particular
time, you may not want the user to be able to click a link. In this case
you can disable it. If you decide to disable a link, you can change its
color using the DisabledLinkColor property. On the other hand, if
the user is not able to access a link, that is, if a link is disabled, you
can find out the color of that link from the DisabledLinkColor
property.
Here is an example:
System::Void linkLabel1_LinkClicked(System::Object ^ sender,
System::Windows::Forms::LinkLabelLinkClickedEventArgs ^ e)
{
System::Diagnostics::Process::Start(
L"C:\\Program Files\\Internet Explorer\\iexplore.exe",
L"http://www.functionx.com/vcnet");
}