問題來源: http://www.cnblogs.com/del/archive/2009/03/13/1410935.html#1803351 TWebBrowser 調(diào)用的是 IE, 放縮頁面是在 IE7 之后才支持的. 準(zhǔn)備工作: 1、添加 WebBrowser1、Button1 2、激活窗體的 OnCreate 事件、激活 Button1 的 OnClick 事件. 代碼如下: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, OleCtrls, SHDocVw, StdCtrls; type TForm1 = class(TForm) WebBrowser1: TWebBrowser; Button1: TButton; procedure FormCreate(Sender: TObject); procedure Button1Click(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm} const OLECMDID_OPTICAL_ZOOM = 63; procedure TForm1.FormCreate(Sender: TObject); begin WebBrowser1.Navigate('http://del.cnblogs.com'); end; procedure TForm1.Button1Click(Sender: TObject); var ZoomIn: OleVariant; begin ZoomIn := 150; WebBrowser1.ExecWB(OLECMDID_OPTICAL_ZOOM, OLECMDEXECOPT_DODEFAULT, ZoomIn); end; end. |
|