简体   繁体   中英

RichtextBox Disable Auto Formatting Rtf

When I change the Rtf property in the RichtextBox it is auto formatting it again. I want to avoid that because it deletes items from color, font and other tables.

"\b\b" -> "\b"
"\cf1 hello \cf3 world" -> color #2 in the color-table is getting deleted
//so that cf3 doesn't make any sense anymore

Can I disable this "auto formatting" ?

The RTF control was designed to be manipulated via SelectionStart and SelectionLength properties, followed by rtf attributes, such as SelectionColor = yada-yada-yada . To manipulate the RTF data would require parsing the RTF string property, and that is fraught with difficulties to correctly identify rtf control characters and rtf text, along with keeping the font and color indexes in sync.

The answer to your question is no, you cannot disable the auto-generation of the rtf code from the control.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM