Re: RichText Formatting Urls
- From: "Michael South" <michaelsouth@xxxxxxxxxxxx>
- Date: Tue, 21 Feb 2006 00:37:13 -0000
Hi,
Thank for the help but I'm not sure what a Regex.Replace operation is. I
load the names and urls from a file so I might note down the char positons
of the names and do it that way.
In the mean time I created a hyperlink in Word and copied and pasted it to
Wordpad. This worked which means RTF does support named links. So I saved it
as an RTF file to have a look at the rich text tags. When I used these tags
with the .Text or .SelectedText propeties for the rich text control it
simply displayed the tags as well.
However there is a RTF property against the control which gets the current
RTF text being displayed (including tags) and you can set this property to.
When I set the .RTF property to the code the word pad created it almost
worked. It displayed the name and the url ! Which means it isn't displaying
the RTF like Wordpad or Word is.
So I'm now thinking about displaying my text with HTML in .NET 2s web
browser control inless anyone has any better bright ideas ?
Mike
"Cerebrus99" <zorg007@xxxxxxxx> wrote in message
news:uw0Q8xhNGHA.1760@xxxxxxxxxxxxxxxxxxxxxxx
Hi Michael,
IMHO, there is no other "elegant" way to do this, except through coding. I
do think that creating a custom version of the RichTextBox control may not
be a viable option just to implement this functionality, in your case.
Before the text is loaded into the RichTextBox, you might use a
Regex.Replace operation to replace all text that matches a URL format, to
be
replaced by some name for the URL. Though, if you don't know beforehand,
what URL's might be present in the text, then it might become difficult
A Regex pattern that selects all URL's in any text is :
"(?:(?:mailto\:|(?:news|(?:ht|f)tp(?:s?))\://){1}(\S+))" (It stores the
part after the :// in a backreference.)
Hope that helps,
Regards,
Cerebrus.
"Michael South" <michaelsouth@xxxxxxxxxxxx> wrote in message
news:#ZObDVWNGHA.2636@xxxxxxxxxxxxxxxxxxxxxxx
Hi,
I can display a link in the rich text control which the user can click on
which then opens explorer and takes them to that page. I need to go a
step
further and display the link as a name hiding the URL behind it but when
clicked on opens up explorer in the same way. Is there some rich text
tags/codes that I can add to my text to-do this ?
I could store all the names and Urls when I load the text into the
control
and then if the mouse is over that string then use that Url if the user
clicks on it. I just wondered if there was a more elegant way of doing a
basic html operation in rich text.
Thank for any help.
Mike
.
- Follow-Ups:
- Re: RichText Formatting Urls
- From: Cerebrus99
- Re: RichText Formatting Urls
- References:
- RichText Formatting Urls
- From: Michael South
- Re: RichText Formatting Urls
- From: Cerebrus99
- RichText Formatting Urls
- Prev by Date: Using Rich Textbox .Lines property
- Next by Date: RE: Merging DropDownItems to ContextMenuStrip
- Previous by thread: Re: RichText Formatting Urls
- Next by thread: Re: RichText Formatting Urls
- Index(es):
Relevant Pages
|