The Windows Forms RichTextBox control is used for displaying, entering, and manipulating text with formatting. The RichTextBox control does everything the TextBox control does, but it can also display fonts, colors, and links; load text and embedded images from a file; and find specified characters. The RichTextBox control is typically used to provide text manipulation and display features similar to word processing applications such as Microsoft Word.
How to set the text colour
1. Set all the text in the same colour
There are two methods to the text colour:
1) Set the text colour in code:
this->rtxbx->ForeColor = Color::Blue; //set it as Blue colour
2) Set the text colour from the property window
2. Set different colour for each text message1). The function is used to set the colour for each text message.
void AppendText(RichTextBox^ box, String^ text, Color color)
{
box->SelectionLength = 0;
box->SelectionStart = box->TextLength;
box->SelectionColor = color;
box->AppendText(text);
box->SelectionColor = box->ForeColor;
}
2) Call the function to set the text colour
For example:
this->rtxbx->Text = “”;
AppendText(this->rtxbx, “Text in Red colour”, Color::Red);
AppendText(this->rtxbx, “Text in Blue colour”, Color::Blue);
AppendText(this->rtxbx, “Text in Yellow colour”, Color::Yellow);
AppendText(this->rtxbx, “Text in Black colour”, Color::Black);
I just couldn’t depart your website before suggesting that I extremely loved the
standard info a person supply to your guests? Is going to
be back often in order to check up on new posts