How can I make a click on button1
the text of richTextBox2
become a certain color, and I click on button2
text from the vertical bar | become the color of button2
, my code below effects the color change of the entire text. I would appreciate your help, thanks in advance!
Code:
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
richTextBox2.ForeColor = Color.Green;
}
private void button2_Click(object sender, EventArgs e)
{
richTextBox2.ForeColor = Color.Red;
}
private void richTextBox2_TextChanged(object sender, EventArgs e)
{
richTextBox2.Text = richTextBox1.Text;
}
}
}