Set this as your homepage for your webbrowser, please note that it's URL is similar to your full classname;
system.windows.forms.richtextbox[
^]
- You can use the Text[^] property to retrieve the text without any markup.
- You can use SelectionStart[^] and SelectionLength[^] to select a piece of text, say the one without markup that you inserted.
- You can then use SelectionColor[^] and SelectionFont[^] to apply a specific formatting to that selected piece of text. There's more ways of manipulating the RichTextBox, as there are also properties for alignment and indentation. Browse a bit on your new homepage, you'll find some very helpfull things.
My personal favorite would be
SelectionProtected[
^]
You can use this property to prevent the user from modifying sections of text within the control
Aw, as an additional suggestion, it would be handier to keep a lightweight version of the data in Memory. How a about a System.Generic.List<mymessage>, with
MyMessage
looking somewhat similar to like below?
public class MyMessage
{
Public String EmailSender { get; set; }
Public String MessageContent { get; set; }
Public DateTime FellIntoOurInboxOn { get; set; }
}
Now, you would have the data somewhere in memory, and you have two views that you can manipulate at will, not only by content, but also in formatting.
A last quick tip;
DetectURLS[
^] is what you'd need if you want to have urls' in your RichTextBox - adding additional clickable functionality, so the user can invoke an action inlined with what he reads. The hyperlink click could be handled inside your application, if I recall correctly, could launch another application, or fetch a website.