【发布时间】:2011-09-20 16:40:28
【问题描述】:
我希望在选定的文本下划线,但发现下划线继续到下一个选项卡- 停止
示例代码
//rtbList is a richTextBox
rtbList.AppendText("\t");
selStart = rtbList.TextLength;
rtbList.AppendText("Bought");
rtbList.SelectionStart = selStart;
rtbList.SelectionLength = rtbList.TextLength - selStart;
rtbList.SelectionFont = hdgFont; // bold & underline
rtbList.AppendText("\t");
//
selStart = rtbList.TextLength;
rtbList.SelectionLength = 0;
rtbList.AppendText("Maturity");
rtbList.SelectionStart = selStart;
rtbList.SelectionLength = rtbList.TextLength - selStart;
rtbList.SelectionFont = hdgFontNoUnderline;
有没有办法克服这个问题,或者它是 rtf 格式的一个基本“缺陷”?
[显然我可以通过使用固定格式来避免这种情况,例如“Courier”和构造字符串
用空格对齐文本。]
【问题讨论】:
标签: c# winforms richtextbox