简体   繁体   English

RichtextBox禁用自动格式化Rtf

[英]RichtextBox Disable Auto Formatting Rtf

When I change the Rtf property in the RichtextBox it is auto formatting it again. 当我在RichtextBox中更改Rtf属性时,它将再次自动格式化。 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 . RTF控件被设计为通过SelectionStartSelectionLength属性,然后是rtf属性(例如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. 要操纵RTF数据,需要解析RTF字符串属性,这很难正确识别rtf控制字符和rtf文本,同时还要使字体和颜色索引保持同步。

The answer to your question is no, you cannot disable the auto-generation of the rtf code from the control. 问题的答案是否定的,您不能从控件中禁用rtf代码的自动生成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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