with saveDialog1 do
begin
fileName:='1'+'.DAT';
execute;
if fileExists(fileName) then
case Application.MessageBox('文件已经存在,覆盖吗?','文件已存在?',MB_YESNOCANCEL) of
IDYES:
begin
deleteFile(fileName);
showMessage('保存中..');
end
IDNO: // 我想还是停留在SaveDialog那里--怎么写?
IDCANCEL: //我想回到程序中,即关闭SaveDialog --怎么写?
end;谢谢
begin
fileName:='1'+'.DAT';
execute;
if fileExists(fileName) then
case Application.MessageBox('文件已经存在,覆盖吗?','文件已存在?',MB_YESNOCANCEL) of
IDYES:
begin
deleteFile(fileName);
showMessage('保存中..');
end
IDNO: // 我想还是停留在SaveDialog那里--怎么写?
IDCANCEL: //我想回到程序中,即关闭SaveDialog --怎么写?
end;谢谢
procedure TForm1.Button1Click(Sender: TObject);
begin
with saveDialog1 do
begin
fileName:='1'+'.DAT';
while true do
begin
if not(Execute) then exit;
if fileExists(fileName) then
case Application.MessageBox('文件已经存在,覆盖吗?','文件已存在?',MB_YESNOCANCEL) of
IDYES:
begin
deleteFile(fileName);
showMessage('保存中..');
break;
end;
IDNO: // 我想还是停留在SaveDialog那里--怎么写?
begin
//
end;
IDCANCEL: //我想回到程序中,即关闭SaveDialog --怎么写?
begin
break;
end;
end;
end;
end;
end;
begin
Options := [ofOverwritePrompt];
FileName:='1'+'.DAT';
if not Execute then Exit;
DeleteFile(FileName);
showMessage('保存中..');
end;
with SaveDialog1 do
begin
Options := [ofOverwritePrompt];
FileName:='1'+'.DAT';
if not Execute then Exit;
if FileExists(FileName) then DeleteFile(FileName);
showMessage('保存中..');
end;