procedure TForm1.DoZoomInClick(Sender: TObject);
var
W,H: Integer;
begin
W := Image1.Width*2;
H := Image1.Height*2;
TgtRect := Rect(0,0,W,H);
// ScrRect == Size of Bitmap
Image1.Height := H;
Image1.Width := W;
// After the copy, the bitmap is sized in Image1.
// Scollbars can be used to view Image-parts outside viewport.
Image1.Canvas.CopyRect(TgtRect,Bitmap.Canvas,SrcRect);
Debug.Text:=Format('Img W: %d, H: %d , Sbx W: %d, H: %d , Bm W: %d, H %d' ,
[ Image1.Width,Image1.Height,ScrollBox1.Width,ScrollBox1.Height,Bitmap.Width, Bitmap.Height]);
end;
procedure TForm1.DoZoomOutClick(Sender: TObject);
var
W,H: Integer;
begin
W := Round(Image1.Width*0.5);
H := Round(Image1.Height*0.5);
TgtRect := Rect(0,0,W,H);
// ScrRect == Size of Bitmap
Image1.Height := H;
Image1.Width := W;
// After the copy, the bitmap is sized in Image1.
// Scollbars can be used to view Image-parts outside viewport.
Image1.Canvas.CopyRect(TgtRect,Bitmap.Canvas,SrcRect);
Debug.Text:=Format('Img W: %d, H: %d , Sbx W: %d, H: %d , Bm W: %d, H %d' ,
[ Image1.Width,Image1.Height,ScrollBox1.Width,ScrollBox1.Height,Bitmap.Width, Bitmap.Height]);
end;