so i have a string of characters that are typically formatted like this:
" text" where the bold character is red.
i want to display these types of strings in a richtextbox with the bold character being red.
i have the text in a string variable and i have the location of the red character (in the string) in an int variable.
my solution is:
- get characters before the red character
- get red character
- get characters after the red character
- display characters before the red character
- display red character (with foreground = Brushes.Red)
- display characters after the red characters
this is what i've got so far:
https://github.com/icebbyice/rapide/blob/master/rapide/SpreadWindow.xaml.cs
find: "//stackoverflow" (also, seperateOutputs is not completed)
i stopped there because i thought there had to be a more efficient way to do it because i will be changing the content of the rich text box often (up to 1000 content changes / 60 seconds).
so, is there a better way to do this?
You could do this:
That belongs in the
RichTextBox
TextChanged
Event
If you type e, it will display it Bold. Any other text will be displayed as
Font.Regular
If you would like to change the syntax from e, then look at the
keywords
string
This is all I have for this, I hope it helps you :)