我的原程序是这样的:
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;