whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1541)

Database (90)
Files (137)
Forms (107)
Graphic (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Math (76)
Misc (126)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (266)
VCL (242)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

52 Visitors Online


 
...zoom the view of a TWebBrowser?
Autor: Rainer Kümmerle
Homepage: http://www.thinklazy.de
[ Print tip ]  

Tip Rating (51):  
     


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;

 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners