将图片保存为bmp格式的,图片有点大;
代码如下:
var
dc:HDC;
fullCanvas:TCanvas;
bm:TBitmap;
dlg1: TSavePictureDialog;
begin
dc:=GetDC(0);
fullCanvas:=TCanvas.Create;
dlg1:=TSavePictureDialog.Create(nil);
bm:=TBitmap.Create;
fullCanvas.Handle:=dc;
try
if dlg1.Execute then
begin
bm.Width:=Screen.Width;
bm.Height:=Screen.Height;
bm.Canvas.CopyRect(Rect(0,0,bm.Width,bm.Height),fullCanvas,Rect(0,0,Screen.Width,Screen.Height));
bm.SaveToFile(dlg1.FileName+'.bmp');
end
Delphi截图保存格式及大小差异

本文介绍了如何在Delphi中实现截图功能,并通过比较将图片保存为BMP和PNG格式时的大小差异,强调了PNG格式能有效减小图片体积。
最低0.47元/天 解锁文章
8784

被折叠的 条评论
为什么被折叠?



