要求很高么?一般来说使用 TCanvas.StretchDraw 或者 API: Stretchblt应该够用了
procedure TForm1.ZoomInOut(bitmap: TBitmap; m, n: extended);
var
Mybmp: TBitmap;
begin
self.DoubleBuffered := True;
Mybmp := TBitmap.Create;
// Trun()和Round()什么区别??
Mybmp.Width := Trunc(m * Self.Image1.Width);
Mybmp.Height := Trunc(n * self.Image1.Height);
image1.Width := Mybmp.Width;
image1.Height := MyBmp.Height;
SetStretchBltMode(Mybmp.Canvas.Handle, HalfTone);
Stretchblt(Mybmp.Canvas.Handle, 0, 0, Mybmp.Width,
Mybmp.Height, OriginalBmp.Canvas.Handle, 0, 0, OriginalBmp.Width,
OriginalBmp.Height,
SRCCOPY);
Mybmp.PixelFormat := pf24bit;
//MyBmp.Assign(newbmp);
image1.Picture.Bitmap.Assign(MyBmp);
MyBmp.Free;
end;