Delphi image 等比例缩小


本文整理自网络,侵删。

 
//等比例缩小
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;

相关阅读 >>

firemonkey使用android的路径信息

Delphi 创建console-控制台应用

Delphi ioutils 单元(5): tdirectory.tdirectory 的其他功能

Delphi 图像处理 二值化

Delphi raise 语句: 抛出异常

Delphi 如何将access的ole对象字段存储的bmp图象显示出来

Delphi idftp连不上ftp服务器的解决方法

Delphi 批量生成 a到z 字母

Delphi paramstr的用法

Delphi 列出所有可视窗口

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...