![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
|
syntax coloring in rich text boxes
i searched both this site and google, but what i found was either incomplete or too hard for me to understand. so the question is how can i make certain words in a rich text box appear as different colors, bold, italic, etc. depending on what word they are? thanks.
__________________
Children in the dark cause accidents, and accidents in the dark cause children. http://www.ronincoders.org |
|
|
|
|
|
#2 |
|
Expert Programmer
|
If you wish to do this using the RichEdit control (which probably isn't the best choice), you can search using regular expressions, and modify the selection's formatting to your choice (using bold etc properties). However this will be incredibly slow - you'll actually see the cursor moving and selecting words: it is slightly better if you search through the rtf markup directly (rtftext property) and apply the formatting directly.
However I think you should borrow from an existing syntax highlighting editor (e.g. Scite/Scintilla), as the rtf control would require lots of overriding to stop the pasting of pictures, showing line numbers etc. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|