I wish color of text was eg green when user inputs it into RichTextBox control. I use sth like:
private void richTextBox1_TextChanged(object sender, CancelEventArgs e)
{
RichTextBox richTextBox1 = sender as RichTextBox;
richTextBox1.SelectionBackColor = Color.AliceBlue;
}
But it cause that first sign is in normal background, and starting from second sign whole eneterd text is blue:
pattern(upper case is colored): eNTERED TEXT
代替TextChanged在OnKeyDown上尝试
I presume you want to set:
richTextBox1.ForeColor = Color.AliceBlue
somewhere after your InitializeComponent();
or via the Background property
in the Designer.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.