一直没太懂你的意思,我是理解为你用image放一个图片,自己做处理,然后保存到某一目录,按这个思路,用copyfileto的话 const DEFPATH = 'd:\';implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject); begin if OpenPictureDialog1.Execute then image1.Picture.LoadFromFile(OpenPictureDialog1.FileName); //处理图片 end;procedure TForm1.Button2Click(Sender: TObject); begin if CopyFileTo(OpenPictureDialog1.FileName, DEFPATH + ExtractFileName(OpenPictureDialog1.FileName)) then ShowMessage('Copy Success') else ShowMessage('Copy Failed'); end;
还是用手动吧SAVEAS(FILENAME) ;
在处理完图片后,加行保存的代码行吗?
image1.picture.savetofile('保存路径');
savetofile的参数是带路径的完整的文件名,不是路径。你在处理之前应该可以拿到它的名字,那时你保存起来,这里再用就ok了,如果每有名字的话,就自己随便给它加个名字存里。
在此我先谢谢大哥们的支持!!
const
defaultpath = 'd:\mypicture\';
.......................
//对放在image1里的图片进行了处理,之后保存
// 处理动作
........................
// 保存到指定路径
image1.picture.savetofile(defaultpath + yourpicturename);
..................
const
DEFPATH = 'd:\';implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenPictureDialog1.Execute then
image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
//处理图片
end;procedure TForm1.Button2Click(Sender: TObject);
begin
if CopyFileTo(OpenPictureDialog1.FileName,
DEFPATH + ExtractFileName(OpenPictureDialog1.FileName)) then
ShowMessage('Copy Success')
else
ShowMessage('Copy Failed');
end;