LinkArea Structure
Represents an area within a LinkLabel control that represents a hyperlink within the control.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
| Name | Description | |
|---|---|---|
![]() | LinkArea(Int32, Int32) | Initializes a new instance of the LinkArea class. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | Determines whether this LinkArea is equal to the specified object.(Overrides ValueType.Equals(Object).) |
![]() | GetHashCode() | Returns the hash code for this instance.(Overrides ValueType.GetHashCode().) |
![]() | GetType() | |
![]() | ToString() | Returns the fully qualified type name of this instance.(Overrides ValueType.ToString().) |
| Name | Description | |
|---|---|---|
![]() ![]() | Equality(LinkArea, LinkArea) | Returns a value indicating whether two instances of the LinkArea class are equal. |
![]() ![]() | Inequality(LinkArea, LinkArea) | Returns a value indicating whether two instances of the LinkArea class are not equal. |
There are two ways to add a hyperlink to the text of a LinkLabel control. You can access the Add method of the LinkLabel.LinkCollection class through the Links property of the LinkLabel to add multiple hyperlinks to the control's text. If you only need to add a single hyperlink to the text of the control, you can use the LinkArea property of the LinkLabel. This property accepts a LinkArea that defines the location of the hyperlink within the control's text. When a hyperlink is specified using the LinkArea property, the link area is then added to the LinkLabel.LinkCollection in the same manner as adding the link using the Add method of the LinkLabel.LinkCollection.
The Length property specifies the number of characters within the text of the LinkLabel to include in the link area. The Start property specifies the first character in the control text to include in the hyperlink. If you want to determine whether a specific LinkArea is empty, you can use the IsEmpty property instead of checking the values of the Start and Length properties.
The following code 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.
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.



