LinkLabel.Link Class
TOC
Collapse the table of content
Expand the table of content

LinkLabel.Link Class

 

Represents a link within a LinkLabel control.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

System.Object
  System.Windows.Forms.LinkLabel.Link

[<TypeConverterAttribute(typeof(LinkConverter))>]
type Link = class end

NameDescription
System_CAPS_pubmethodLinkLabel.Link()

Initializes a new instance of the LinkLabel.Link class.

System_CAPS_pubmethodLinkLabel.Link(Int32, Int32)

Initializes a new instance of the LinkLabel.Link class with the specified starting location and number of characters after the starting location within the LinkLabel.

System_CAPS_pubmethodLinkLabel.Link(Int32, Int32, Object)

Initializes a new instance of the LinkLabel.Link class with the specified starting location, number of characters after the starting location within the LinkLabel, and the data associated with the link.

NameDescription
System_CAPS_pubpropertyDescription

Gets or sets a text description of the link.

System_CAPS_pubpropertyEnabled

Gets or sets a value indicating whether the link is enabled.

System_CAPS_pubpropertyLength

Gets or sets the number of characters in the link text.

System_CAPS_pubpropertyLinkData

Gets or sets the data associated with the link.

System_CAPS_pubpropertyName

Gets or sets the name of the LinkLabel.Link.

System_CAPS_pubpropertyStart

Gets or sets the starting location of the link within the text of the LinkLabel.

System_CAPS_pubpropertyTag

Gets or sets the object that contains data about the LinkLabel.Link.

System_CAPS_pubpropertyVisited

Gets or sets a value indicating whether the user has visited the link.

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

The LinkLabel.Link class defines the properties of a link within a LinkLabel control. You can use these properties to provide data to the LinkClicked event of the LinkLabel control to perform tasks when the link is clicked in the control. The LinkData property enables you to define information that the LinkClicked event can use to display a URL within Microsoft Internet Explorer or to open a file.

In addition to information related to the link, the properties of the LinkLabel.Link class also help define the text of the LinkLabel.Link and its display state. The Start and Length properties define the location and length of text from the text of the LinkLabel control to display as a link. The Enabled property allows you to display the link as a disabled link, and the Visited property can alert the user that they already visited the specified link in the current instance of the LinkLabel.

You can display multiple links in a single LinkLabel control. Each LinkLabel.Link is added into the LinkLabel.LinkCollection associated with the LinkLabel control. To obtain the collection of links defined in a LinkLabel control, use the LinkLabel.Links property.

The following example demonstrates using the LinkLabel class, with multiple LinkArea sections defined, to display a label on a form. The example demonstrates setting the AutoSize, LinkBehavior, DisabledLinkColor, LinkColor, and VisitedLinkColor properties to customize the look of the LinkLabel. The first LinkArea is specified using the LinkLabel.LinkArea property. Additional links are added to the LinkLabel using the LinkLabel.LinkCollection.Add method. The example handles the LinkClicked event by starting the Web browser for hyperlinks, and displaying a MessageBox for other links.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft