Y
yirong
Unregistered / Unconfirmed
GUEST, unregistred user!
运行下面源码正常, 只是还有两个问题未解决:<br>1.pict2:='e:/sf_stuff/image1/'+pict1; <br>SaveDialog1.FileName:=PICT2; //保存的指定位置<br>指定位置我想设置成服务器的目录下,结果指定位置显示成OPENDIAG.FILENAME+PICT2<br>2.退出表单显示:STACKOVERFLOW错误, 是不是因为没有用留变量所引起.<br><br><br><br><br>procedure Tm_product.BitBtn3Click(Sender: TObject);<br>var<br>pict,pict1,pict2:string;<br>pic3,pic1:tjpegimage;<br>begin<br> s_PROD_dict.Edit;<br> pict:=opendialog1.FileName;<br> if PICT <>'' then //取得文件执行<br> BEGIN<br> PICT1:=ExtractFileName(opendialog1.FileName);<br> s_PROD_dict['picture']:=pict1; //图片文件名保存到一字段<br>pict2:='e:/sf_stuff/image1/'+pict1; <br>SaveDialog1.FileName:=PICT2; //保存的指定位置<br>Pic1:=TJpegImage.Create;<br> pic1.loadfromfile(pict); //取得OPENDIAG1所取得JPG文件<br> Pic1.savetofile(SaveDialog1.FileName); //保存到指定位置<br><br>//测试把保存的图片文件显示出来<br>Pic3:=TJpegImage.Create;<br> image1.Picture.Graphic := nil;<br> pict1:=s_prod_dict.fieldbyname('picture').asstring;<br>PICT2:='e:/sf_stuff/image1/'+pict1; //<br>SaveDialog1.FileName:=PICT2;<br>Pic3.loadfromfile(SaveDialog1.FileName); //取得指定位置的图片文件<br> image1.Picture.Graphic:=pic3;<br> pic3.Free ;<br> strm.Free ;<br> PIC1.Free;<br>end;<br>end;