这是我的图片保存代码 执行后就算图片存在也不会询问是否覆盖 你输入了名字 无论同名在于不在都会覆盖!procedure TForm1.Save1Click(Sender: TObject); begin if Self.SavePictureDialog1.Execute then begin Image1.Picture.Bitmap.SaveToFile(SavePictureDialog1.FileName + '.bmp'); end; end;
Options ofOverwritePrompt
if SavePictureDialog1.Execute then if FileExists(SavePictureDialog1.FileName) then if Application.MessageBox('文件已经存在,是否要覆盖?', '提示', MB_ICONQUESTION + MB_YESNO) = IDYes then image1.Picture.SaveToFile(SavePictureDialog1.FileName);
begin
if Self.SavePictureDialog1.Execute then
begin
Image1.Picture.Bitmap.SaveToFile(SavePictureDialog1.FileName + '.bmp');
end;
end;
ofOverwritePrompt
if FileExists(SavePictureDialog1.FileName) then
if Application.MessageBox('文件已经存在,是否要覆盖?', '提示', MB_ICONQUESTION + MB_YESNO) = IDYes then
image1.Picture.SaveToFile(SavePictureDialog1.FileName);
还有Filter也会有影响你看看是不是这个问题