frReplacAll 如果是真值,应用程序将ReplaceText属性中的字符串替换,
查找到的所有FindText属性中的字符串。
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
例程中TEditForm.Replace方法响应OnReplace事件,Replace方法首先判断控制中被
选中字符串是否与替换字符串相等,如果不等则进行替换。而后根据Options中的方式循
环进行查找替换。直至无匹配字符串为止。其代码如下:
procedure TEditForm.Replace(Sender: TObject);
var
Found: Boolean;
begin
with ReplaceDialog1 do
begin
if AnsiCompareText(Memo1.SelText, FindText) = 0 then
Memo1.SelText := ReplaceText;
Found := SearchMemo(Memo1, FindText, Options);
while Found and (frReplaceAll in Options) do
begin
Memo1.SelText := ReplaceText;
Found := SearchMemo(Memo1, FindText, Options);
end;
if (not Found) and (frReplace in Options) then
ShowMessage('Cannot find "' FindText '".');
end;
end;
上一篇: Delphi 文本编辑器的设计(四)
下一篇: 用Delphi实现QQ窗体的缩入伸出功能
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




