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 tzipfile 用法

Delphi 如何判断html编码格式,解决乱码问题

Delphi版的隐藏模块单元 hidemoduleunit.pas

Delphi 控制台关闭指定窗口

Delphi case of

Delphi树的一些操作

Delphi firemonkey移动应用程序将设置保存到ini文件的示例

Delphi with do和for do语句

Delphi 苹果系统弹出链接

Delphi shellexecute调用系统命令关闭计算机

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



打赏

取消

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

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

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

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

评论

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