bb := ResizeBitmap(b, 0.25);
将b变为原来的1/4
function ResizeBitmap(oBitmap: TBitmap; exRate: Extended): TBitmap;
var
nb: TBitmap;
r : TRect;
begin
Result := nil;
if exRate <= 0 then Exit;
nb := TBitmap.Create;
nb.Height := Round(oBitmap.Height * exRate);
nb.Width := Round(oBitmap.Width * exRate);
r.TopLeft := Point(0, 0);
r.BottomRight := Point(nb.Width, nb.Height);
with nb.Canvas do
begin
Pen.Style := psDash;
Brush.Style := bsClear;
Rectangle(0, 0, nb.Width, nb.Height);
StretchDraw(r, TGraphic(oBitmap));
end;
Result := nb;
end;