我想遍历当前的编辑器中的文本,然后把某种颜色的字体抽取出来,添加到编辑器后面进行显示,代码如下,我运行以后,虽然设定的颜色字体被取出来了,但是并没有在编辑器中显示出来。还请帮忙看一下。
int length = this.textControl1.TextFields.GetItem().Length;
TXTextControl.TextField newtextfield = new TXTextControl.TextField();
int L = 1;
this.textControl1.Selection.Start = 0;
for (int i = 0; i < length; i++)
{
this.textControl1.Selection.Start = i;
this.textControl1.Selection.Length = L;
if (this.textControl1.Selection.ForeColor.Name.ToString() == "ff000000")
{
newtextfield.Text = this.textControl1.Selection.Text;
bool sign = this.textControl1.TextFields.Remove(newtextfield);
}
}
|
|