TWebBrowser 问题(100)

  • 主题发起人 主题发起人 cooldren
  • 开始时间 开始时间
C

cooldren

Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, OleCtrls, SHDocVw, ActiveX;type TForm1 = class(TForm) wb: TWebBrowser; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);var str:string; StrStream:TStringStream;begin str:='<html><head></head><body>';// str:=str+'<a href="file:///E|/新版/林肯.jpg">'; str:=str+'<a href="E:/新版/林肯.jpg">'; str:=str+'<img src="file:///E|/新版/林肯.jpg" id="bigimg" width="160" alt="林肯.jpg" border="0"></a>'; str:=str+'</body></html>'; WB.Navigate('about:blank'); StrStream:=TStringStream.Create(pchar(str)); try StrStream.Position:=0; (WB.Document as IPersistStreamInit).Load(TStreamadapter.Create(StrStream)); finally StrStream.Free; end;end;end.写到webbrowser 中后, 超连接打不开请问是怎么回事,高手帮忙
 
<html><head></head><body><a href="file:///E:/个人文档/1.jpg"><img src="file:///E:/个人文档/1.jpg" id="bigimg" width="160" alt="1.jpg" border="0"></a></body></html>
 
但把这个另存为htm文件在IE中打开,可以单击图片打开是不是编码问题
 
procedure TForm2.Button1Click(Sender: TObject);var str:string;begin str:='<html><head></head><body>';// str:=str+'<a href="file:///E|/新版/林肯.jpg">'; str:=str+'<a href="E:/新版/林肯.jpg">'; str:=str+'<img src="file:///E|/新版/林肯.jpg" id="bigimg" width="160" alt="林肯.jpg" border="0"></a>'; str:=str+'</body></html>'; WB.Navigate('about:<head><title>标题></title><body>页面内容</body>'); if not (WB.Busy) then begin WB.Navigate('about:'+str); end;end;
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
811
import
I
后退
顶部