说三道四技术文摘-感悟人生的经典句子
说三道四 > 文档快照

在RichEdit中的串查找-Delphi资料

HTML文档下载 WORD文档下载 PDF文档下载
在RichEdit中的串查找-Delphi资料

procedure TMainForm.FindDialogFind(Sender: Tobject);

var

FoundAt: LongInt;

StartPos

ToEnd: integer;

SearchFlag: TSearchTypes;

begin

if frMatchCase in FindDialog.Options then

SearchFlag:=[stMatchCase];

if frWholeWord in FindDialog.Options then

SearchFlag:=SearchFlag+[stWholeWord];

with RichEdit do

begin

StartPos:=SelStart+SelLength;

ToEnd:=Length(Text) - StartPos;

FoundAt:=FindText(FindDialog.FindText

StartPos

ToEnd

[stMatchCase]);

if FoundAt<>-1 then

begin

SetFocus;

SelStart:=FoundAt;

SelLength:=Length(FindDialog.FindText);

end

else

begin

SelLength:=0;

SelStart:=StartPos;

Application.MessageBox(Pchar('找不到'+FindDialog.FindText)

'查找失败'

0);

end;

end;

end;

备案号:鲁ICP备13029499号-2 说三道四 www.s3d4.cn 说三道四技术文摘