Rtftextbox and hyperlinks / anchors within a document

A few hours ago, I found it very easy to render a * .rtf document using the .net 2.0 standard winforms control (RichTextBox). It's really great that it can even display pictures, but there is one missing feature for me - the hyperlink. I have prepared a * .rtf document with multiple hyperlinks to paragraphs within the document. Then I put this file in resources and loaded into the rtf property of the control, but unfortunately, clicking on the links doesn't work. Is there a hack or workaround to enable hyperlinks?

EDIT:

My client will prepare one short document (say one * .docx file or one * .html file).

It will contain several chapters, and we want to place a small table of contents at the top of the document.

The expected behavior is that the user clicks on the topic and the control scrolls its content to the desired location in the document.

So maybe it's not about links, but about bookmarks.


Ok, I'll try to describe most of the required solution.

My client will prepare one short document (say one * .docx file or one * .html file).

It will contain several chapters, and we want to place a small table of contents at the top of the document.

The expected behavior is that the user clicks on the topic and the control scrolls its content to the desired location in the document.

So maybe it's not about links, but about bookmarks.

0


source to share


1 answer


How are your links formatted and is the DetectUrl value true?

From codeproject -> only links starting with one of the recognized protocols (http :, file :, mailto :, ftp :, https :, gopher :, nntp :, prospero :, telnet :, news :, wais :, outlook :) are recognized and reformatted.

http://www.codeproject.com/KB/edit/RichTextBoxLinks.aspx



http://msdn.microsoft.com/en-us/library/system.windows.forms.richtextbox.detecturls(VS.80).aspx

The Microsoft article has an example of the LinkClicked event.

private void Link_Clicked (object sender, System.Windows.Forms.LinkClickedEventArgs e)
{
   System.Diagnostics.Process.Start(e.LinkText);
}

      

+1


source







All Articles