Re: Adding hidden text to a rich text box control

  • Thread starter =?ISO-8859-1?Q?Martin_M=FCller?=
  • Start date
?

=?ISO-8859-1?Q?Martin_M=FCller?=

James Meehan said:
I have an application where I want to insert display text plus hidden
link information into a rich text box control. The link information
would be hidden by using the rtf format code (/v) for hiding text. If I
use the SelectedText filed, then the format codes are ignored. If I use
the SelectedRtf field, then nothing is inserted. Any help would be
appreciated.

I'm doing something similar at the moment and it works fine most of the time.
Just remember that your RichTextBox's Text/SelectedText property shows all
the text (including "{\v HiddenText}"), whereas the RichTextBox itself
does not render this "HiddenText".
Btw. you're using \v and not /v as stated, do you?

Anyway, take a look at this small code snipplet:

string strTextToHide = "Now you don't";
richTextBox1.Text = "Now you see me,.";
richTextBox1.Select(15,0);
richTextBox1.SelectedRtf = @"{\rtf1\ansi{\v "+strTextToHide+"}}";
MessageBox.Show("Text: "+richTextBox1.Text);
MessageBox.Show("RTF: "+richTextBox1.Rtf);

Hope this helps,
Martin Müller
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top