I have the following code :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace PentruTestari
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
richTextBox2.Text = "int int";
richTextBox2.SelectionStart = 0;
richTextBox2.SelectionLength = 7;
richTextBox2.SelectionColor = Color.Red;
richTextBox2.SelectionLength = 0;
richTextBox2.SelectionStart = 4;
richTextBox2.SelectionColor = Color.Black;
}
private void richTextBox2_Click(object sender, EventArgs e)
{
MessageBox.Show(richTextBox2.SelectionColor.ToString());
}
}
}
Every time I click right before the second "int" , the SelectionColor is black. But when I click at the middle of the first "int" and then click back at the beginning of the first "int" the SelectionColor is red and it should remain black.
I have this problem in a project I am working at and this is the reproduction of the problem.
I will give any extra details.