delphi 改变位图图片大小


本文整理自网络,侵删。

 delphi 改变位图图片大小
procedure pic_fitbmp(const Source,Dest:string;const x,y:integer);
var
abmp,bbmp:tbitmap;
scalex,scaley:real;
begin
abmp:=tbitmap.Create;
bbmp:=tbitmap.Create;
try
abmp.LoadFromFile(Source);
scaley:=abmp.Height/y;
scalex:=abmp.Width/x;
bbmp.Width:=round(abmp.Width/scalex);
bbmp.Height:=round(abmp.Height/scaley);
bbmp.PixelFormat:=pfDevice;
SetStretchBltMode(bbmp.Canvas.Handle,COLORONCOLOR);
stretchblt(bbmp.Canvas.Handle,0,0,bbmp.Width,bbmp.Height,abmp.Canvas.Handle,0,0,abmp.Width,abmp.Height,srccopy);
bbmp.SaveToFile(Dest);
finally
abmp.Free;
bbmp.Free;
end;
end;

相关阅读 >>

Delphi 获取internet缓存文件

Delphi 显示简单图形

Delphi-idhttp-json用法

Delphi unigui unistringgrid1 清空

Delphi xe下支持unicode编码方式

Delphi 提取字符串中所有数字

Delphi 如何检测你的电脑日期或时间的变化

Delphi 从记事本导入记录

Delphi xe mysql数据库操作类 mysqlhelper

Delphi unigui 控件动画

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



打赏

取消

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

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

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

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

评论

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