LinkLabel Control in C#.Net
LinkLabel is a class which is derived from label class so it has all the
functions of label class. But LinkLabel control
works as a hyperlink and its appearance
is also as hyperlink.
Drag and drop LinkLabel control from toolbox on the window Form.

Code:
Write code on LinkClicked event

private
void linkLabel1_LinkClicked(object sender,
LinkLabelLinkClickedEventArgs e)
{
//after visiting site
LinkLabel color changed which will indicate that
you have visited this site
linkLabel1.LinkVisited
= true;
System.Diagnostics.Process.Start("www.mindstick.com");
//using the start method of system.diagnostics.process
class
//process class gives access to local and remote
processes
}
System.Diagnostics.Process.Start
The System.Diagnostics namespace
exposes a Process class that you can use to launch external programs.You can
launch a new process with the shared Process.Start method, passing it either the
name of an executable file or a filename with an extension associated with an
executable application.
Run the project

When you click on the link Go toGoogle then LinkClicked event will fire
and redirected to the www.google.com.

LinkLabel Properties:
LinkBehaviour: Behaviour
of link can be changed through LinkBehaviour properties LinkLabel.
Example:
private
void Form9_Load(object
sender, EventArgs e)
{
//disable
underline
linkLabel1.LinkBehavior =
LinkBehavior.NeverUnderline;
}

Now when application run then Underline will not show in LinkLabel.
ForeColor:
set the foreground color of the LinkLabel control.
BackColor: set the background color of LinkLabel
control.
Example:
private
void Form9_Load(object
sender, EventArgs e)
{
//change BackColor of LinkLabel
linkLabel1.BackColor = Color.CadetBlue;
}

|