procedure TForm1.ShowHtml(Browser:TWebBrowser;content: string);
var
vv: Variant;
HTMLDocument: IHTMLDocument2;
begin
vv := VarArrayCreate([0,0],varVariant);
vv[0] := content;
HTMLDocument := browser.Document as IHTMLDocument2;
HTMLDocument.write(PSafeArray(TVarData(vv).VArray));
// HTMLDocument.charset := 'gb2312';
HTMLDocument.close;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
WebBrowser1.Navigate('suninrain.delphibbs.com');
(WebBrowser1.Document as IHTMLDocument2).Set_designMode('On')
end;
要先判断 Browser 是不是有加载就可以了,不错