Hyperlinks of KetticDocument in RichTextBox in C#.NET
KetticRichTextBox control allows the users to insert and customize the hyperlinks in contents of KetticDocument. It provides the hyperlinks functionality in C# classes of HyperlinkInfo, HyperlinkRangeStart, and HyperlinkRangeEnd. The HyperlinkInfo are the objects that allow the users to insert links to the KetticControls for Windows Forms. The HyperlinkRangeStart and HyperlinkRangeEnd are Inline DocumentElements, which are able to be added to the inlines inside a document. In addition, this control allows the users to set the tool tip format of hyperlinks.
Using HyperlinkInfo Objects to Add Links in C#.NET
The HyperlinkInfo of KetticRichTextBox control contains a few properties for the users to insert links to the Kettic UI WinForms controls, for example, IsAnchor, NavigateUri, and Target. The IsAnchor property determines the hyperlink points to a URL or a bookmark. The NavigateUri determines the URI of the hyperlink and the Target property determines the links that will be opened. The C# code below shows how to insert a link to document of KetticRichTextBox.
Methods for Inserting a Hyperlink to Document
Remove Hyperlink from Document of KetticRichTextBox
To remove a hyperlink from the document, we are able to position the caret in the hyperlink and invoke by using the C# code snippet as below.
HyperlinkRangeStart and HyperlinkRangeEnd for Inserting Links
KetticRichTextBox control provides the HyperlinkRangeStart and HyperlinkRangeEnd to add hyperlink to inlines of document. The C# code below demonstrates how to create a document with a hyperlink which spans different paragraphs.
The HyperlinkRangeStart and HyperlinkRangeEnd allow the users to implement a custom logic with hyperlink, get the entire hyperlinks from the document, and customize the HyperlinkInfo properties as well as all the parts of the document. The C# code below shows how to delete all hyperlinks in the document and replace the links with text.
More Customizing Options of KetticRichTextBox
ToolTip, the hyperlinks use a fixed string as a tool tip and the users can use the HyperlinkToolTipFormatString of KetticRichTextBox to set the format for all hyperlinks in the document.
HyperlinkClicked, this event will be fired as clicking on a hyperlink and will send the document element like a Span, an Image, InlineUIContainer, and more. This event provides the possibility to mark the handled event and prevent the default action.
UI Controlsfor Windows Forms.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls