Delphi image 等比例缩小
2021-01-01 15:29
标签:mfile div color draw free str rect use xtend Delphi image 等比例缩小 标签:mfile div color draw free str rect use xtend 原文地址:https://www.cnblogs.com/jijm123/p/14198263.html//等比例缩小
uses Math;
var
Zoom:Extended;
W,H:integer;
bmp:Tbitmap;
begin
bmp:=Tbitmap.Create;
bmp.LoadFromFile(‘c:\aa.bmp‘);
Zoom:=Image1.Width/Max(bmp.Width,bmp.Height); //获得比例值
W:=Trunc(bmp.Width*Zoom);
H:=Trunc(bmp.Height*Zoom);
//居中显示缩小后的图片
Image1.Canvas.StretchDraw(Rect(Trunc((Image1.width-W)/2),Trunc((Image1.Height-H)/2),Trunc((Image1.width-W)/2)+W,Trunc((Image1.Height-H)/2)+H),Bmp);
bmp.free;
end;
文章标题:Delphi image 等比例缩小
文章链接:http://soscw.com/index.php/essay/39370.html