I want to colour certain characters as they are typed in a RichTextBox. I
started with this simple event handler.
private void rtb_KeyPress(ob ject sender, KeyPressEventAr gs e)
{
if (e.KeyChar >= ' ')
{
this.SelectedTe xt = e.KeyChar.ToStr ing();
this.SelectionC olor = Color.Blue;
e.Handled = true;
}
}
Why does this code not colour the first character typed into the box? It
works for subsequent characters.
Eq.
started with this simple event handler.
private void rtb_KeyPress(ob ject sender, KeyPressEventAr gs e)
{
if (e.KeyChar >= ' ')
{
this.SelectedTe xt = e.KeyChar.ToStr ing();
this.SelectionC olor = Color.Blue;
e.Handled = true;
}
}
Why does this code not colour the first character typed into the box? It
works for subsequent characters.
Eq.
Comment