delphi 截图函数ScreenShot


本文整理自网络,侵删。

  program ScreenShot;

uses
Windows,
Graphics,
Jpeg;

procedure ScreenToFile(FileName: string; Quality: Word; Percent: Word);
var
Bmp: TBitmap;
Jpg: TJpegImage;
begin
Bmp := TBitmap.Create;
Jpg := TJpegImage.Create;
try
Bmp.Width := GetDeviceCaps(GetDc(0), 8) * Percent div 100;
Bmp.Height := GetDeviceCaps(GetDc(0), 10) * Percent div 100;
SetStretchBltMode(Bmp.Canvas.Handle, HALFTONE);
StretchBlt(Bmp.Canvas.Handle, 0, 0, Bmp.Width, Bmp.Height, GetDc(0), 0, 0, GetDeviceCaps(GetDc(0), 8), GetDeviceCaps(GetDc(0), 10), SRCCOPY);
Jpg.Assign(Bmp);
Jpg.CompressionQuality := Quality;
Jpg.SaveToFile(FileName);
finally
Jpg.free;
Bmp.free;
end;
end;

begin
ScreenToFile('SHOT.JPG', 50, 70);
end.

相关阅读 >>

Delphi memo1 行随机打乱

Delphi 中相对路径与绝对路径函数说明

Delphi输入字符与tlistbox项目匹配

Delphi sender 的用法举例

Delphi xe5实现通过tmemorystream将一个unicodestring写入到一个unicode文本文件

Delphi with 语句的妙用

Delphi now 返回当前日期及时间

Delphi中单独编译pas生成dcu文件

Delphi 之 定时器 (ttimer组件)

Delphi字符串加密解密

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



打赏

取消

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

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

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

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

评论

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