Zooming Out and Zooming In (Delphi 6.0)
Take the following steps to add code that can reduce and enlarge the displayed size of the image. This demonstrates the scaling properties that are normally used for zooming in and zooming out. It emphasizes the relationship of the displayed rectangle to the LEAD Raster View control.
1. |
Start with the project that you created in Loading and Displaying an Image. |
|
2. |
Add two buttons to your form and name them as follows: |
|
|
Name |
Caption |
|
btnZoomIn |
Zoom In |
|
btnZoomOut |
Zoom Out |
3. |
Code the btnZoomIn button's click procedure as follows: |
procedure TForm1.btnZoomInClick(Sender: TObject);
begin
LEADRasterView1.AutoSetRects := True;
LEADRasterView1.PaintSizeMode := PAINTSIZEMODE_ZOOM;
LEADRasterView1.PaintZoomFactor := LEADRasterView1.PaintZoomFactor + 10;
end;
4. |
Code the btnZoomOut button's click procedure as follows: |
procedure TForm1.btnZoomOutClick(Sender: TObject);
begin
LEADRasterView1.AutoSetRects := True;
LEADRasterView1.PaintSizeMode := PAINTSIZEMODE_ZOOM;
if ( LEADRasterView1.PaintZoomFactor > 10 ) then
LEADRasterView1.PaintZoomFactor:= LEADRasterView1.PaintZoomFactor - 10;
end;
5. |
Run your program to test it. |