高手帮忙啊
procedure TForm1.WebBrowser1DocumentComplete(ASender: TObject;const pDisp: IDispatch; var URL: OleVariant);
var
  browser:   IHTMLDocument2;
  vHTMLElementCollection:   IHTMLElementCollection;
  vHTMLElement:   IHTMLElement;
  I:   Integer;
begin
  browser   :=   WebBrowser1.Document   as   IHTMLDocument2;
  vHTMLElementCollection   :=   browser.all;
  for   I   :=   0   to   vHTMLElementCollection.length   -   1   do   
  begin
    vHTMLElement   :=   vHTMLElementCollection.item(I,   I)   as   IHTMLElement;
    if vHTMLElement.tagName='IMG' then begin
      if vHTMLElement.getAttribute('src',0)='Img1' then begin
         //怎样保存此IMG到TImage中
      Break;
    end;
end;
end;
end;

解决方案 »

  1.   

    只要你能取到WebBrowser中图片对应的URL地址,把它载入到Image中显示就非常容易。你取到URL地址了吗?
      

  2.   

    你可以在缓存中获得该图片
    CommitUrlCacheEntry   Caches   data   in   the   specified   file   in   the   cache   storage   and   associates   it   with   the   given   URL.     
      CreateUrlCacheEntry   Allocates   the   requested   cache   storage   and   creates   a   local   file   name   for   saving   the   cache   entry   corresponding   to   the   source   name.     
      CreateUrlCacheGroup   Generates   a   cache   group   identification.     
      DeleteUrlCacheEntry   Removes   the   file   associated   with   the   source   name   from   the   cache,   if   the   file   exists.     
      DeleteUrlCacheGroup   Releases   a   GROUPID   and   any   associated   state   in   the   cache   index   file.     
      FindCloseUrlCache   Closes   the   specified   enumeration   handle.     
      FindFirstUrlCacheEntry   Begins   the   enumeration   of   the   cache.     
      FindFirstUrlCacheEntryEx   Begins   a   filtered   enumeration   of   the   cache.     
      FindNextUrlCacheEntry   Retrieves   the   next   entry   in   the   cache.     
      FindNextUrlCacheEntryEx   Retrieves   the   next   entry   in   a   filtered   cache   enumeration.     
      GetUrlCacheEntryInfo   Retrieves   information   about   a   cache   entry.     
      GetUrlCacheEntryInfoEx   Searches   for   the   URL   after   translating   any   cached   redirections   that   would   be   applied   in   offline   mode   by   HttpSendRequest.     
      ReadUrlCacheEntryStream   Reads   the   cached   data   from   a   stream   that   has   been   opened   using   RetrieveUrlCacheEntryStream.     
      RetrieveUrlCacheEntryFile   Retrieves   a   cache   entry   from   the   cache   in   the   form   of   a   file.     
      RetrieveUrlCacheEntryStream   Provides   the   most   efficient   and   implementation-independent   way   of   accessing   the   cache   data.     
      SetUrlCacheEntryGroup   Adds   or   removes   entries   from   a   cache   group.     
      SetUrlCacheEntryInfo   Sets   the   specified   members   of   the   INTERNET_CACHE_ENTRY_INFO   structure.     
      UnlockUrlCacheEntryFile   Unlocks   the   cache   entry   that   was   locked   when   the   file   was   retrieved   for   use   from   the   cache   by   RetrieveUrlCacheEntryFile.     
      UnlockUrlCacheEntryStream   Closes   the   stream   that   has   been   retrieved   using   RetrieveUrlCacheEntryStream.   
      

  3.   

    IHTMLDocument2有个images属性,可以直接取得image的itemcollection.不需要遍历全部的element.
      

  4.   

    你的解决方案是什么?能共享一下吗?我的方法是如果你取到WebBrowser中图片对应的URL地址,用下载的方法取和流,然后把流载入到Image里面显示即可,需要代码的话可以给你写出来。