替換對話框部件為應用程序提供替換對話框
與查找對話框一樣
表
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
取值 含義
────────────────────────────────────────
frRelpace 如果是真值
frReplacAll 如果是真值
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
例程中TEditForm
procedure TEditForm
var
Found: Boolean;
begin
with ReplaceDialog
begin
if AnsiCompareText(Memo
Memo
Found := SearchMemo(Memo
while Found and (frReplaceAll in Options) do
begin
Memo
Found := SearchMemo(Memo
end;
if (not Found) and (frReplace in Options) then
ShowMessage(
end;
end;
打開對話框部件為應用程序顯示打開對話框
打開對話框包含一個Filters(過濾器)的屬性
例程中關於文件打開的代碼如下
procedure TEditForm
begin
if OpenDialog/
begin
…
Open(Open Dialog/
end
end;
打開
表
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
值 含義
──────────────────────────────────────
ofAllowMultiSelect 如果是真值
ofCreatePrompt 如果是真值
ofExiengronDifferent 如果是真值
ofFileMustExist 如果是真值
ofNoChangeDir 如果是真值
ofOverWritePrompt 如果是真值
ofPathMastExit 如果是真值
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
表
文件保存對話框與打開對話框類似
procedure TEditForm
procedure CreateBackup(const Filename: string)
var
BackupFilename: string;
begin
BackupFilename := ChangeFileExt(Filename
DeleteFile(BackupFilename)
RenameFile(Filename
end;
function IsReadOnly(const Filename: string)
begin
Result := Boolean(FileGetAttr(Filename) and faReadOnly)
if Result then MessageDlg(Format(
[ExtractFilename(Filename)])
end;
begin
if (Filename =
SaveAs
else
begin
CreateBackup(Filename)
Memo
Memo
end;
end;
其中CreateBackup過程用以改變需備份文件的擴展名
[
From:http://tw.wingwit.com/Article/program/Delphi/201311/25250.html