直接修改TWebBrowser显示内容

procedure TForm1.Button1Click(Sender: TObject);
**begin
** Webbrowser1.Navigate('about:blank');
end ;

procedure TForm1.Button2Click(Sender: TObject);
**var
** V: OleVariant;
**begin
** V := WebBrowser1.Document;
s := '

1<html><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/></head><body>'+   
2'<style type="text/css">' +   
3'body {font-family: "宋体", "Times New Roman"; font-size: 12px;margin-left: 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;}' +   
4'</style><b>Welcome!</b></body>';   
5V.Script.Document.Body.InnerHTML := s;   
6**end** ;</html>
Published At
Categories with Web编程
comments powered by Disqus