WebBrowser1.Navigate('http://USER-2017-15/commonpdf/35734.jpg'); //打開指定頁面
用上面的程式打開一張圖片后很大,瀏覽器裝不下,請問怎么縮小?我是用Delphi寫的。
uj5u.com熱心網友回復:
uses MSHTML;
IHtmlDocument2(WebBrowser1.document).parentWindow.execScript('document.body.style.zoom=0.5;', 'javascript');
uj5u.com熱心網友回復:
在縮放網頁的時候,多點兩下縮放按鈕就出現了例外。請問程式怎么修改?uj5u.com熱心網友回復:
uj5u.com熱心網友回復:
我的原程式是這樣的:shrink是一個整數,在單元開頭進行宣告,并在表單創建時給初值shrink=0
procedure TfrmLiterature.SpeedButton2Click(Sender: TObject);
var
s:string;
begin
shrink:=shrink+1;
if shrink=1 then s:='0.5';
if shrink=2 then s:='0.4';
if shrink=4 then s:='0.3';
if shrink=5 then s:='0.2';
if shrink=6 then s:='0.1';
if shrink=7 then s:='0.08';
if shrink=8 then s:='0.05';
if shrink=9 then s:='0.01';
if shrink=10 then s:='0.005';
if shrink=11 then s:='0.003';
if shrink=12 then s:='0.0005';
if shrink=13 then s:='0.00005';
try
IHtmlDocument2(WebBrowser1.document).parentWindow.execScript('document.body.style.zoom='+s+';', 'javascript');
except
exception.Create('系統例外!請關掉本視窗,再重新打開。');
end;
end;
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/47740.html
標籤:網絡通信/分布式開發
上一篇:Delphi7的stringgird控制元件怎么修改cell里的數字且不變回初始數字
下一篇:FastReport 問題
