Name

LinkLabel

Synopsis

This Control, derived from Label, adds the ability to insert one or more hyperlinks in the control Text.

By default, the whole text is assigned to a single link. To specify a range of text that constitutes the link (instead of the entire text), you can assign a LinkArea value to the LinkArea property. You can determine whether the link has been clicked through the LinkVisited property.

If you wish to create several links within the text, you can add items to the Links collection. You need to Clear() the collection first to get rid of the default link, then create new Link instances to Add() to the collection.

See Link for more information on the class.


public class LinkLabel : Label : IButtonControl {

// Public Constructors

   public LinkLabel();

// Public Instance Properties

   public Color ActiveLinkColor{set; get; }

   public Color DisabledLinkColor{set; get; }

   public LinkArea LinkArea{set; get; }

   public LinkBehavior LinkBehavior{set; get; }

   public Color LinkColor{set; get; }

   public LinkCollection Links{get; }

   public bool LinkVisited{set; get; }

   public override string Text{set; get; }

// overrides Control

   public Color VisitedLinkColor{set; get; }

// Protected Instance Properties

   protected Cursor OverrideCursor{set; get; }

// Protected Instance Methods

   protected override AccessibleObject CreateAccessibilityInstance();  // overrides Label

   protected override void CreateHandle();  // overrides Control

   protected override void OnEnabledChanged(EventArgs e);  // overrides Label ...

Get .NET Windows Forms in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.