各位朋友帮忙:OPENDIAG把图片文件名保存到字段中,运行中出现的问题. ( 积分: 100 )

  • 主题发起人 主题发起人 yirong
  • 开始时间 开始时间
Y

yirong

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