Home > Back-end >  Delphi does prawns in the webBrowser control shows how to set the proportion of web page
Delphi does prawns in the webBrowser control shows how to set the proportion of web page

Time:09-17

WebBrowser1. Navigate (' http://USER-2017-15/commonpdf/35734.jpg ');//open the specified page

After opened by the application of the above picture is large, the browser to hold, how to reduce the excuse me? I was written in Delphi,

CodePudding user response:

 
USES MSHTML;

IHtmlDocument2 (WebBrowser1. Document). ParentWindow. ExecScript (' document. The body. The style.css. Zoom=0.5; ', 'javascript');

CodePudding user response:

Web page when zooming in or out, two more zoom button appeared abnormal, could you tell me how to modify the program?

CodePudding user response:

CodePudding user response:

My program is like this:
The shrink is an integer, declared at the beginning of the unit, and in the form when created for initial value the shrink=0

Procedure TfrmLiterature. SpeedButton2Click (Sender: TObject);
Var
S: a string;
The begin
The shrink:=the shrink + 1;
If the shrink=1 then s:='0.5';
If the shrink=2 then s:='0.4';
If the shrink=4 then s:='0.3';
If the shrink=5 then s:='0.2';
If the shrink=6 then s:='0.1';
If the shrink=7 then s:='0.08';
If the shrink=8 then s:='0.05';
If the shrink=9 then s:='0.01';
If the shrink=10 then s:='0.005';
If the shrink=11 then s:='0.003';
If the shrink=12 then s:='0.0005';
If the shrink=13 then s:='0.00005';

Try
IHtmlDocument2 (WebBrowser1. Document). ParentWindow. ExecScript (' document. The body. The style.css. Zoom='+ +' s; ', 'javascript');
Except,
Exception. Create (' system exception! Please turn off the window, open again, ');
end;
end;
  • Related