procedure WB_Set3DBorderStyle(Sender: TObject; 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; except //.. end; end; procedure TFrmWebBrowser.WebBrowser1DocumentComplete(Sender: TObject; const pDisp: IDispatch; var URL: OleVariant); begin WB_Set3DBorderStyle(Sender,false); end;
top:=-2;
height:=panel1.height+4;
left:=-2;
width:=panel1.width+4;
把panel设置成没有边框的,这样就看不到了
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;
except
//..
end;
end;
procedure TFrmWebBrowser.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
begin
WB_Set3DBorderStyle(Sender,false);
end;