随笔 - 2146  文章 - 97 评论 - 11767 trackbacks - 253


问题来源: http://www.cnblogs.com/del/archive/2009/03/13/1410935.html#1803351

TWebBrowser 调用的是 IE, 放缩页面是在 IE7 之后才支持的.

准备工作:
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.

posted on 2010-04-16 16:51  万一  阅读(...)  评论(...编辑  收藏