且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

RichTextBox控件令人头疼

更新时间:2023-02-25 11:59:23

首先,不要伪造,Tab也用于导航.使用System.Windows.Controls.RichTextBox.AcceptsTab来控制此行为.自己决定自己随时喜欢什么:标签导航或文档中的标签字符.

现在,文档中的选项卡从来都不是用于对齐列之类的可靠工具.通过设计!
原则上,有一种使用Word表的方法,但这非常微妙.
阅读此线程: http://social.msdn. microsoft.com/forums/zh-CN/winforms/thread/38f8618e-5532-4e55-b7c0-24d10749f99c [ http://www.go4answers.com/Example/seletedrtf-rich-text-box-build-tables-33280.aspx [ ^ ].

CodeProject成员 Pete O''Hanlon 有一个有趣的答案,但我从来没有测试了它:在richtextbox中创建表 [
First, don''t forger, Tab is also used for navigation. Use System.Windows.Controls.RichTextBox.AcceptsTab to control this behavior. Decide for yourself what do you prefer at every moment: Tab navigation or Tab character in the document.

Now, Tabs in the document had never been a reliable tool for aligning columns or something like that. By design!
In principle, there is a way to use Word tables, but this is very subtle.
Read this thread: http://social.msdn.microsoft.com/forums/en-US/winforms/thread/38f8618e-5532-4e55-b7c0-24d10749f99c[^], and this one: http://www.go4answers.com/Example/seletedrtf-rich-text-box-build-tables-33280.aspx[^].

There is an interesting answer of the CodeProject member Pete O''Hanlon, but I never tested it: Create a table in richtextbox[^]; you may want to ask him for more detail.

—SA