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;
在對應的WebBrowser 事件中加入即可
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
begin
W_Set3DBorderStyle(sender,false);
end;