uses MSHTML;
///获取Webbrowser编辑模式里面的内容
procedure EditMode();
begin
  (Form1.WebBrowser1.Document as 
IHTMLDocument2).designMode := ‘on‘;
end;
//------------------------------------------------------------------------------
procedure ViewMode();
begin
  (Form1.WebBrowser1.Document as 
IHTMLDocument2).designMode := ‘off‘;
end;
TWebBrowser非常特殊,它从TWinControl继承来的SetFocus方法并不能使得它所包含的文档获得焦点
//方法1
procedure 
TForm1.ToolButton1Click(Sender: TObject);
begin
   if Form1.WebBrowser1.Document <> nil then
     with WebBrowser1.Application as IOleobject do
        DoVerb(OLEIVERB_UIACTIVATE, 
nil, WebBrowser1, 0, Handle, GetClientRect());
end;
//方法2 
Form1OnCreate事件无效
//OnShow可以
if WebBrowser1.Document <> nil then
    IHTMLWindow2(IHTMLDocument2(WebBrowser1.Document).ParentWindow).Focus();delphi 11 编辑模式 浏览模式,布布扣,bubuko.com
原文:http://www.cnblogs.com/xe2011/p/3876353.html