Re: C Sharp RichEditBox HyperLinks
From: Brett Verhagen (kalluminati2001_at_yahoo.com)
Date: 01/08/04
- Next message: goose: "Re: Theodore Adorno, a prophet of data systems design"
- Previous message: gswork: "Re: PC uptime, was EGN twaddle"
- In reply to: Programmer Dude: "Re: C Sharp RichEditBox HyperLinks"
- Next in thread: Programmer Dude: "Re: C Sharp RichEditBox HyperLinks"
- Reply: Programmer Dude: "Re: C Sharp RichEditBox HyperLinks"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 8 Jan 2004 01:07:24 -0800
Ok I'll try to explain this the best I can. I am using visual studios
net. I have a C Sharp form with a RichTextEditBox. In the text field i
tell it to say www.google.com. So the code goes something like this
richTextBox1.SelectedText = "www.google.com";
Ok when I do that the text is underlined and if the user clicks on the
text this event will be called
private void richTextBox1_LinkClicked(object sender,
System.Windows.Forms.LinkClickedEventArgs e)
Which is perfect. The only problem is I do not want the text to say
google.com or any other address for that matter. Now in word I can
create files that that have the extension rtf. I also found code that
will load a rtf into my RichTextBox. It will load colors, text, fonts,
and hyperlinks.
Now using word I can take any letters or string of letters and
instruct the computer to bring up any web address I like whenever the
letters are clicked. regardless of what the letters say.
The problem is when I do that and try to load this rtf document into
my RichTextBox it does not work. The text I selected is underlined and
appears to be a link but when I click the text nothing happens. The
LinkClicked event is supposed to run. I think that maybe by clicking
the text another event is called.
> > In the text field I display something like "www.google.com" and
> > when the user clicks it, my code is run.
>
> What "text field"? In the RTF document?
I am talking about in the RichTextBox in the text field. In C Sharp I
run code similar to this :
richTextBox1.SelectedText = "www.google.com";
> Your code runs when loaded
> into the RTF Edit control? If so, the solution may be easy. Use
> Word to edit the link (Word allows you to specify both what appears
> on the document and what the link text is). Then use a plain text
> editor to see what Word did with the RTF. I tried it, and got this
> (extracted from the entire document):
>
Yeah I have been able to do that with word. It works exactly how I
want it to in word. Unfortunatly when I load the "working" rtf
document onto my form. When I load the document into my RichTextBox
The link does not act the same. The text is underlined and appears to
be a link. But when the text www.google.com is clicked this event runs
private void richTextBox1_LinkClicked(object sender,
System.Windows.Forms.LinkClickedEventArgs e)
when I load the rtf document and the hyperlink is clicked this event
does not run. I have only been able to get that event to run when the
text is that of a web address. Maybe another event is called, if i
could figure out which event gets called that would work.
> I wrote an RTF "notepad"-alike a while back that had active links
> (not to webpages, but to various commands). What I did was catch
> user double-clicks, use that to get the click point, work both
> ways (forwards and backwords) to find the word, and once I had that,
> it was just a matter of dispatching on the clicked word.
I am probably going to have to do that. Of course the coding and the
ensuing errors sounds high.
Thanks
Brett
- Next message: goose: "Re: Theodore Adorno, a prophet of data systems design"
- Previous message: gswork: "Re: PC uptime, was EGN twaddle"
- In reply to: Programmer Dude: "Re: C Sharp RichEditBox HyperLinks"
- Next in thread: Programmer Dude: "Re: C Sharp RichEditBox HyperLinks"
- Reply: Programmer Dude: "Re: C Sharp RichEditBox HyperLinks"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|