uses里添加mshtml单元procedure TForm1.FormShow(Sender: TObject);
begin
wb.SetBounds(0,0,600,500);
wb.Navigate('http://www.computing-age.com');
end;procedure TForm1.wbDocumentComplete(Sender: TObject;const pDisp: IDispatch; var URL: OleVariant);
var doc:IHTMLDocument2;
begin
if wb.ReadyState=READYSTATE_COMPLETE then begin
doc:=wb.Document as IHTMLDocument2;
showmessage(inttostr((doc.body as IHTMLElement).offsetWidth));
showmessage(inttostr((doc.body as HTMLBody).clientWidth));
showmessage(inttostr((doc.body as IHTMLElement2).scrollWidth));
showmessage(inttostr(wb.ClientWidth));
end;
end;网页宽度理应是Webbroswer的2倍,但是4个结果依次是596,596,596,600,有没有办法获取正确的数值?但计算其他网页如sina,baidu的宽度均是正确的,谢谢
begin
wb.SetBounds(0,0,600,500);
wb.Navigate('http://www.computing-age.com');
end;procedure TForm1.wbDocumentComplete(Sender: TObject;const pDisp: IDispatch; var URL: OleVariant);
var doc:IHTMLDocument2;
begin
if wb.ReadyState=READYSTATE_COMPLETE then begin
doc:=wb.Document as IHTMLDocument2;
showmessage(inttostr((doc.body as IHTMLElement).offsetWidth));
showmessage(inttostr((doc.body as HTMLBody).clientWidth));
showmessage(inttostr((doc.body as IHTMLElement2).scrollWidth));
showmessage(inttostr(wb.ClientWidth));
end;
end;网页宽度理应是Webbroswer的2倍,但是4个结果依次是596,596,596,600,有没有办法获取正确的数值?但计算其他网页如sina,baidu的宽度均是正确的,谢谢
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货