System.Windows.Forms.LinkLabel.LinkArea Property

Gets or sets the range in the text to treat as a link.

Syntax

[System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.Repaint)]
[System.ComponentModel.Editor("System.Windows.Forms.Design.LinkAreaEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.Drawing.Design.UITypeEditor))]
[System.ComponentModel.Localizable(true)]
public LinkArea LinkArea { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

The LinkLabel.LinkArea property provides a quick way to specify a single hyperlink to display in the text of the System.Windows.Forms.LinkLabel control. The System.Windows.Forms.LinkArea object provides properties that specify the starting position of the link within the text of the control and the length of text for the hyperlink. When a hyperlink is specified using the LinkLabel.LinkArea property, the hyperlink is added to the System.Windows.Forms.LinkLabel.LinkCollection of the control. The LinkLabel.LinkArea property converts the System.Windows.Forms.LinkArea object assigned to it to a System.Windows.Forms.LinkLabel.Link object that is stored within the collection.

To add multiple hyperlinks to the text of the control, you can use the LinkLabel.Links property. The LinkLabel.Links property enables you to access the properties and methods of the System.Windows.Forms.LinkLabel.LinkCollection, which stores the links specified for the control. This method of adding links to the System.Windows.Forms.LinkLabel also enables you to specify data in the System.Windows.Forms.LinkLabel.Link.LinkData property that is associated with the link being created. The value of the System.Windows.Forms.LinkLabel.Link.LinkData property can be used to store the location of a file to display or the address of a Web site.

When a System.Windows.Forms.LinkLabel control is created, a default hyperlink that contains all the text within the System.Windows.Forms.LinkLabel control is added to the System.Windows.Forms.LinkLabel.LinkCollection. You can override this default link by specifying a new link area with the LinkLabel.LinkArea property, or specify a link using the System.Windows.Forms.LinkLabel.LinkCollection.Add(int, int) method of the System.Windows.Forms.LinkLabel.LinkCollection. You can also remove the default hyperlink by using the System.Windows.Forms.LinkLabel.LinkCollection.Remove(System.Windows.Forms.LinkLabel.Link) method of the System.Windows.Forms.LinkLabel.LinkCollection class.

Note:

The LinkLabel.LinkArea property always returns the first item in the System.Windows.Forms.LinkLabel.LinkCollection, regardless of how the hyperlink was added to the collection.

Note:

The LinkArea.Length property on System.Windows.Forms.LinkArea will differ if you call LinkLabel.UseCompatibleTextRendering, and the LinkLabel.Text property contains double-byte characters. If you call LinkLabel.UseCompatibleTextRendering, it will return the number of bytes in the string. Otherwise, it will return the number of actual characters.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0