I use RichTextBoxto display an RTF file that includes one hyperlink. The link text is not a URL (the target is a valid URL). RTF was created using Word. Both Word and WordPad correctly recognize links (WordPad does not launch links, but shows the corresponding cursor on the hand).
When I load RTF into RichTextBoxlinks, they are displayed correctly formatted (blue and underlined), but instead of behaving like a link, when the cursor moves over the link, it remains an I- LinkClickedray, the event LinkClickedwill not work, and it actually shows the target between the angle brackets after links (this does not seem correct). Since the link text is not a URL, DetectUrlsthis will not help.
Is there a reason why RichTextBoxthese links are not properly handled or a way to make them work as expected?
Here is the code
TipView.Rtf = tips[tipIndex];
// I've also tried TipView.LoadFile, with identical result
To reproduce the problem, create an RTF document with Word (I use 2000) containing one link, the text of which is not a URL, but is intended for a valid URL, and programmatically load the .rtf file into RichTextBox(I use .NET 2.0 in C # Express 2008).
snarf source
share