//下面是使用WebBrowser控件做的,和你的控件也差不多。 var PhotoStr:string; TxtPhotoStr : IHTMLInputElement; ImgPhoto : IHTMLImgElement; begin try //查找Web页面中存放图片Base64编码的文本框对象 TxtPhotoStr := (WebBrowser.document as IHtmlDocument2).all.item('Txt_InspectPhotoStr', 0) as IHTMLInputElement; //查找Web页面中的Image对象 ImgPhoto := (WebBrowser.document as IHtmlDocument2).all.item('Img_InspectPhoto', 0) as IHTMLImgElement; //如果文本框对象找到则赋值 if TxtPhotoStr <> nil then TxtPhotoStr.value := PhotoStr; //如果Image对象找到则赋值 if ImgPhoto <> nil then begin ImgPhoto.src := ''; ImgPhoto.src := aImgFilePath; end; end; except on e:exception do TSysOper.writeLog('导入照片时失败,错误:' + e.Message); end; end;
var
PhotoStr:string;
TxtPhotoStr : IHTMLInputElement;
ImgPhoto : IHTMLImgElement;
begin
try
//查找Web页面中存放图片Base64编码的文本框对象
TxtPhotoStr := (WebBrowser.document as IHtmlDocument2).all.item('Txt_InspectPhotoStr', 0) as IHTMLInputElement;
//查找Web页面中的Image对象
ImgPhoto := (WebBrowser.document as IHtmlDocument2).all.item('Img_InspectPhoto', 0) as IHTMLImgElement;
//如果文本框对象找到则赋值
if TxtPhotoStr <> nil then
TxtPhotoStr.value := PhotoStr;
//如果Image对象找到则赋值
if ImgPhoto <> nil then
begin
ImgPhoto.src := '';
ImgPhoto.src := aImgFilePath;
end;
end;
except on e:exception do
TSysOper.writeLog('导入照片时失败,错误:' + e.Message);
end;
end;