简体   繁体   English

将选中的列表添加到Winforms中的RichTextbox控件中

[英]add a checked list to a RichTextbox Control in Winforms

I'd like to insert the rtf code for a checkbox field in the position where the cursor is within the control but I'm having some problems figuring out how to determine where this position is located within the control's rtf text. 我想在光标位于控件内的位置处插入一个复选框字段的rtf代码,但是在弄清楚如何确定此位置在控件的rtf文本中的位置时遇到了一些问题。 Is this possible? 这可能吗?

像这样

Maybe RichTextBox.CaretPosition is what you need. 也许RichTextBox.CaretPosition是您所需要的。 It gives you a TextPointer value ( System.Windows.Documents.TextPointer ). 它为您提供了一个TextPointer值( System.Windows.Documents.TextPointer )。

https://msdn.microsoft.com/en-us/library/system.windows.controls.richtextbox.caretposition(v=vs.110).aspx https://msdn.microsoft.com/zh-CN/library/system.windows.controls.richtextbox.caretposition(v=vs.110).aspx

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

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