11月 12th, 2009

在webbrowser控件中显示动态html代码

Category: delphi, Author: admin, Popularity: 20%

下面的delphi代码实现了直接在webbrowser控件中显示html代码的功能

var
StrStream:TStringStream;
SetNoteStr: string;
begin
SetNoteStr :=’<body bgcolor=222222 align=center><br><p align=center><font size=+2 color=#FFFFFF>谷歌 http://www.google.com</font></p>’;
SetNoteStr :=SetNoteStr+’<br><p align=center><font size=+2 color=#FFFFFF>实现webbrowser控件中显示动态html的程序代码</font></p>’;
StrStream:=TStringStream.Create(SetNoteStr);
WebBrowser1.Navigate(‘about:blank’);
try
StrStream.Position:=0;
( WebBrowser1.Document as IPersistStreamInit).Load(TStreamadapter.Create(StrStream));
finally
StrStream.Free;
end;
end;

相关日志

Tags:, , , .
评论数量() | Add Comments
本文网址:http://www.9usb.net/200911/delphi-webbrowser-html.html

There are No comments.

» You can leave a response

leave a reply