Let delphi embedded WebBrowser no border no scroll bars

ExpandedBlockStart.gif Code
{  WB_Set3DBorderStyle  }

procedure  WB_Set3DBorderStyle(Sender: TWebBrowser; bValue: Boolean);
var
  Document: IHTMLDocument2;
  Element: IHTMLElement;
  StrBorderStyle: 
string ;
begin
  
// 去掉边框
  
try
    Document :
=  TWebBrowser(Sender).Document  as  IHTMLDocument2;
    
if  Assigned(Document)  then
    
begin
      Element :
=  Document.Body;
      
if  Element  <>   nil   then
      
begin
        
case  BValue  of
          False: StrBorderStyle :
=   ' none ' ;
          True: StrBorderStyle :
=   '' ;
        
end ;
        Element.Style.BorderStyle :
=  StrBorderStyle;
      
end ;
    
end ;     // 去掉滚动条
      Sender.OleObject.Document.Body.Scroll :
=   ' no ' ;
  
except
    
// ..
  
end ;
end ;

 

When this function only TWebBrowser finished loading the page file, call it.

Then the beginning of the html files replace the
<DOCTYPE HTML PUBLIC! "- // W3C // DTD HTML 4.01 Transitional // EN">

Reproduced in: https: //www.cnblogs.com/rogee/archive/2010/09/20/1832037.html

Guess you like

Origin blog.csdn.net/weixin_34289454/article/details/94681085