LinkLabel Control.
The LinkLabel control is similiar to the label control, with the exception of hyperlinks.
The LinkLabel control can display single or multiple hyperlinks. When the user clicks
a hyperlink, the process can be started in th event.
Namespace: System.Windows.Forms
Assembly: Systems.Windows.Forms.dll
using System.Windows.Forms;
Calling: System.Windows.Forms.LinkLabel
Creating a new System.Windows.Forms.LinkLabel control.
LinkLabel linkLabel1 = new LinkLabel();
Adding the LinkLabel control to a Windows form.
this.Controls.Add(linkLabel1);
Assigning text to the LinkLabel control.
linkLabel1.Text = "DotNet Controls";
Using an image with the LinkLabel control.
linkLabel1.Image = Image.FromFile(@"c:\Icons\helloworld.gif");
To create a click event to handle the linklabel click.
linkLabel1.LinkClicked+=new LinkLabelLinkClickedEventHandler(linkLabel1_LinkClicked);
To respond to the linklabel click event.
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs
e) { System.Diagnostics.Process.Start("www.speakcomputers.com"); }
|