Repository navigation
RichTextArea : substring #2809
|
Hi Could you give a small code example for changing the font, foreground color, ... of a substring of the text of a RichTextArea ? (while all other text stays the same font, foreground color, ...) |
Answered by
Serg-Norseman
Sep 9, 2025
Replies: 1 comment 3 replies
|
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You define a range of characters in a string, with a substring - the beginning and the end. Include them in the range - I have a typo there, I mean
new Range<int>(start_of_substring, end_of_substring);(if they are equal - then the formatting change will be applied to 1 character).Then call the change you need. There is a whole family of
.SelectionNproperties (where there are Background, Foreground, FontFamily, Italic, Underline, etc.).