W
windyson
Unregistered / Unconfirmed
GUEST, unregistred user!
我在使用RichEdit控件时,查找文本中出现的某个汉字的位置,然后使其变色,由于RichEdit不处理双字节字符,会出现匹配错误的情况(如前一个汉字
的位码和后一个汉字的区码会被认为是一个汉字),请问如何解决?如果有相应
的增强型RichEdit控件,请问到何处下载?
我的代码是用c++ builder写的,附后,实际执行起来效率不高,请各位高手指
点一二:
... ...
bakstart=RichEdit1->SelStart;
RichEdit1->Enabled=false;
for(unsigned int i=0;i<CompList->Count;i++)
{
startpos=0;
while(1)
{
startpos=RichEdit1->FindText(*(AnsiString *)CompList->Items,startpos,RichEdit1->Text.Length(),TSearchTypes()<< stMatchCase);
if(startpos==-1)
break;
RichEdit1->SelStart=startpos;
RichEdit1->SelLength=2;
RichEdit1->SelAttributes->Color=clRed;
startpos+=RichEdit1->SelLength;
}
}
RichEdit1->SelStart=bakstart;
RichEdit1->Enabled=true;
... ...
的位码和后一个汉字的区码会被认为是一个汉字),请问如何解决?如果有相应
的增强型RichEdit控件,请问到何处下载?
我的代码是用c++ builder写的,附后,实际执行起来效率不高,请各位高手指
点一二:
... ...
bakstart=RichEdit1->SelStart;
RichEdit1->Enabled=false;
for(unsigned int i=0;i<CompList->Count;i++)
{
startpos=0;
while(1)
{
startpos=RichEdit1->FindText(*(AnsiString *)CompList->Items,startpos,RichEdit1->Text.Length(),TSearchTypes()<< stMatchCase);
if(startpos==-1)
break;
RichEdit1->SelStart=startpos;
RichEdit1->SelLength=2;
RichEdit1->SelAttributes->Color=clRed;
startpos+=RichEdit1->SelLength;
}
}
RichEdit1->SelStart=bakstart;
RichEdit1->Enabled=true;
... ...