不是很完善,实际上你可以只写一个缩放的就行了,根据比率来放大还是缩小.下面只是一个
思路和简单可行.
procedure TForm2.Zoom_In(Img: TImage;const Times:Integer);
var
Bmp :TBitmap;
begin
Bmp :=TBitmap.Create;
Bmp.Width :=Img.Picture.Bitmap.Width*Times;
Bmp.Height :=Img.Picture.Bitmap.Height*Times;
StretchBlt(Bmp.Canvas.Handle,0,0,Bmp.Width,Bmp.Height,
Img.Picture.Bitmap.Canvas.Handle,0,0,Img.Picture.Bitmap.Width,Img.Picture.Bitmap.Height,SRCCOPY);
Img.AutoSize :=True;
Img.Picture.Bitmap.Assign(Bmp);
SecondPic.Assign(Img.Picture);
Bmp.Free;
end;
procedure TForm2.Zoom_Out(Img: TImage;const Times:Integer);
var
Bmp :TBitmap;
begin
Bmp :=TBitmap.Create;
Bmp.Width :=Img.Picture.Bitmap.Width div Times;
Bmp.Height :=Img.Picture.Bitmap.Height div Times;
StretchBlt(Bmp.Canvas.Handle,0,0,Bmp.Width,Bmp.Height,
Img.Picture.Bitmap.Canvas.Handle,0,0,Img.Picture.Bitmap.Width,Img.Picture.Bitmap.Height,SRCCOPY);
Img.AutoSize :=True;
Img.Picture.Bitmap.Assign(Bmp);
SecondPic.Assign(Img.Picture);
Bmp.Free;
end;