November 13th, 2012, 08:02 AM
Coloured text within text box
Right... I've come up against something very difficult. However it sounds really easy.
I am basically writing an application to work as a CommWatch program (to display the data going between machines).
It has a couple of ports, lets say for this instance Port A and Port B.
Basically.... I want to put data into a text box (or rich text box) and colour it according to which port it came in on (Red = A, Blue = B).
I have got text changing colour... but as soon as I move onto the next one the previous ones revert to the default colour.
Can anyone help me or recommend to me a custom control to use perhaps?
Thanks in advance.
November 25th, 2012, 09:34 PM
How are you applying the color to the text?
I had a project a while back that involved formatting text in a rich text box and I remember that I had to select the section of text that I wanted to format first and then apply formatting to it similar to:
rtbViewOutput.SelectionStart = <some start point>
rtbViewOutput.SelectionLength = <some length of selection>
rtbViewOutput.SelectionColor = Color.Red
I know I had different formatting on different sections of text.
Hope that helps!