Масштабирование страницы в TWebBrowser

Советы » Браузер » Масштабирование страницы в TWebBrowser

Оформил: DeeCo Автор: http://www.swissdelphicenter.ch

procedure

TForm1.Button1Click(Sender: TObject); begin

//75% of original size WebBrowser1.OleObject.Document.Body.Style.Zoom := 0.75; end

; procedure

TForm1.Button2Click(Sender: TObject); begin

//original size WebBrowser1.OleObject.Document.Body.Style.Zoom := 1; end

; {A page must be already loaded into TWebBrowser} {Eine Seite muss bereits in TWebBrowser geladen sein} //.zoom:=0.25; //25% //.zoom:=0.5; //50% //.zoom:=1.5; //100% //.zoom:=2.0; //200% //.zoom:=5.0; //500% //.zoom:=10.0; //1000% {----------} uses

OleCtrls, SHDocVw; { Suppose That you want to use for buttons to give you the zooming (text size) options of MSIE, Button1 for smallest, Button2 for small, Button3 for medium, Button4 for large and Button5 for Largest, You have to set the value of the tag property for each button as following: 0: for the smallest text size, 1: for the small, 2: for medium, 3: for large, 4: for the largest. } procedure

TForm1.Button1Click(Sender: TObject); var

ZoomFac: OLEVariant; begin

ZoomFac := TButton(Sender).Tag; WebBrowser1.ExecWB(OLECMDID_ZOOM, OLECMDEXECOPT_PROMPTUSER, ZoomFac); end

;

Другое по теме:

Категории

Статьи

Советы

Copyright © 2022 - All Rights Reserved - www.delphirus.com