Spread Windows Forms 9.0 Product Documentation
LinkArea Property (HyperLinkCellType)
Example 


Gets or sets the area of the text that is the hyperlink.
Syntax
'Declaration
 
Public Property LinkArea As LinkArea
'Usage
 
Dim instance As HyperLinkCellType
Dim value As LinkArea
 
instance.LinkArea = value
 
value = instance.LinkArea
public LinkArea LinkArea {get; set;}

Property Value

LinkArea object that defines the location of the hyperlink within the link text
Exceptions
ExceptionDescription
System.ArgumentException Specified start is invalid; must be positive
System.ArgumentException Specified length is invalid; must be positive
System.ArgumentException Specified length is invalid; must be less than or equal to the length of the entire text
Remarks

This is a pair of numbers, the starting character number of the link and the length of the link in number of characters. The link is the text that appears underlined and becomes clickable. The starting character number is zero based; the first character is at position 0.

For example, "Click to See Our Web Site." has 26 characters counting the spaces and the period at the end. To underline and make part of the hyperlink only the words "See Our Web Site", use a LinkArea(9,16); in other words, start at the 10th character in the string and make 16 characters underlined and clickable. To have only the words "Web Site" linkable, use LinkArea(17,8) so the link would start at the 18th character and underline 8 characters.

To select the entire string, start at the very first character and use the Text.Length property to get the length of the string, as in LinkArea(0, cellname.Text.Length).

Example
This example shows the use of the hyperlink cell properties.
FarPoint.Win.Spread.CellType.HyperLinkCellType hlnkcell = new FarPoint.Win.Spread.CellType.HyperLinkCellType();
hlnkcell.BackgroundImage = new FarPoint.Win.Picture(Image.FromFile("..\\images\\mail16a.ico"));
hlnkcell.Link = "http://www.fpoint.com"; 
hlnkcell.LinkArea = new LinkArea(9,16);
hlnkcell.LinkColor = Color.DarkRed;
hlnkcell.Text = "Click to See Our Web Site.";
hlnkcell.VisitedLinkColor = Color.Gray;
fpSpread1.Sheets[0].Cells[7,2].CellType = hlnkcell;
Dim hlnkcell As New FarPoint.Win.Spread.CellType.HyperLinkCellType()
hlnkcell.BackgroundImage = new FarPoint.Win.Picture(Image.FromFile("..\images\mail16a.ico"))
hlnkcell.Link = "http://www.fpoint.com"
hlnkcell.LinkArea = new LinkArea(9,16)
hlnkcell.LinkColor = Color.DarkRed
hlnkcell.Text = "Click to See Our Web Site."
hlnkcell.VisitedLinkColor = Color.Gray
fpSpread1.Sheets(0).Cells(7,2).CellType = hlnkcell
Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows Server 2012 R2, Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10

See Also

Reference

HyperLinkCellType Class
HyperLinkCellType Members

 

 


Copyright © GrapeCity, inc. All rights reserved.