xtd 0.2.0
Loading...
Searching...
No Matches

◆ link_area() [1/2]

xtd::forms::link_area xtd::forms::link_label::link_area ( ) const
noexcept

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

Returns
A xtd::forms::link_area that represents the area treated as a link.
Remarks
The xtd::forms::link_label::link_area property provides a quick way to specify a single hyperlink to display in the text of the xtd::forms::link_label: control. The xtd::forms::link_area 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 xtd::forms::link_label:link_rea property, the hyperlink is added to the xtd::forms::link_label::link_collection of the control. The xtd::forms::link_label:link_area property converts the xtd::forms::link_area object assigned to it to a xtd::forms::link_label::link object that is stored within the collection.
To add multiple hyperlinks to the text of the control, you can use the xtd::forms::link_label::links property. The xtd::forms::link_label::links property enables you to access the properties and methods of the xtd::forms::link_label::link_collection, which stores the links specified for the control. This method of adding links to the xtd::forms::link_label also enables you to specify data in the xtd::forms::link_label::link::link_data property that is associated with the link being created. The value of the xtd::forms::link_label::link_data property can be used to store the location of a file to display or the address of a Web site.
When a xtd::forms::link_label control is created, a default hyperlink that contains all the text within the xtd::forms::link_label control is added to the xtd::forms::link_label::link_collection. You can override this default link by specifying a new link area with the xtd::forms::link_label::link_area property, or specify a link using the xtd::forms::link_label::link_collection::push_back method of the xtd::forms::link_label::link_collection. You can also remove the default hyperlink by using the xtd::forms::link_label::link_collection::erase method of the xtd::forms::link_label::link_collection class.
Note
The xtd::forms::link_label::link_area property always returns the first item in the xtd::forms::link_label::link_collection, regardless of how the hyperlink was added to the collection.