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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top