图象缩小:(其中backbmp为源图)
procedure TMainForm.ZoomoutClick(Sender: TObject);
var
bmp: TBITMAP;
begin
begin
try
bmp := Tbitmap.Create;
bmp.Width := trunc(0.9 * childForm.image1.width);
bmp.Height := trunc(0.9 * childForm.image1.Height);
SetStretchBltMode(Bmp.Canvas.Handle, HalfTone); //如此设置不易失真
stretchblt(bmp.Canvas.Handle, 0, 0, bmp.Width, bmp.Height,
backbmp.Canvas.Handle, 0, 0,
backbmp.Width, backbmp.height, srccopy);
childForm.Image1.Top := childForm.Height div 2 - bmp.Height div 2;
childForm.Image1.Left := childForm.Width div 2 - bmp.Width div 2;
childForm.image1.Picture.Bitmap.Assign(bmp);
bmp.Free;
except
ShowMessage('出错!');
end;
end;
end;