用TWebBrowser组件就可以,等着给分吧[
]
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ActiveX, SHDocVw, MSHTML, StdCtrls, OleCtrls;
.......
procedure TForm1.Button1Click(Sender: TObject);
var
URL: OleVariant;
Strm: TstringStream;
HTML: string;
begin
//构造HTML代码:
//src="file:这里换成你自已的图片就行了
HTML:= ''+
'<html>'+#13#10+
'<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">'+#13#10+
'<img border="0" src="file:///E:/我的照片/PhotoShop/mm001.jpg" width="593" height="844">'+#13#10+
'</body>'+#13#10+
'</html>';
//初始化
URL:= 'about:blank';
WebBrowser1.Navigate2(URL, EmptyParam, EmptyParam, EmptyParam, EmptyParam);
//显示HTML
while WebBrowser1.ReadyState < READYSTATE_INTERACTIVE do Application.ProcessMessages;
if Assigned(WebBrowser1.Document) then
begin
Strm:= TstringStream.Create(HTML);
try
Strm.Seek(0, 0);
(WebBrowser1.Document as IPersistStreamInit).Load(TStreamAdapter.Create(Strm));
finally
Strm.Free;
end;
end;
end;