本文整理自网络,侵删。
Delphi 截图程序方法
最近在做Delphi 屏幕截图,这个我试过了,可以的,有需要的可以试试……
function CaptureScreenRect(ARect:TRect):TBitmap;
var ScreenDC:HDC; //设备描述表的句柄
begin
result:=TBitmap.Create ;
with Result,ARect do
begin
Width :=Right-left;
Height:=Bottom-Top;
ScreenDC:=GetDC(0); //获取一个窗口的设备描述表的句柄,0参数返回屏幕窗口设备描述表的句柄
try
//BOOL BitBlt(hdcDest,nXDest,nYDest,nWidth,nHeight,hdcSrc,nXSrc,nYSrc,dwRop)
//把位图从源设备描述表hdcSrc复制到目标设备描述表hdcDest,
//光栅操作码dwRop指定了 源图的组合方式
BitBlt(Canvas.Handle ,0,0,Width,Height,ScreenDC,left,top,SRCCOPY);
finally
ReleaseDC(0,ScreenDC);
end;
end;
end;
相关阅读 >>
Delphi fdconnection取得excel工作表名
Delphi android实例-退出程序(xe8+小米2)
Delphi isleapyear、isinleapyear - 是否是闰年
Delphi stringgrid 实例4 本例功能: 1、给每个单元格赋值 2、调整当前单元格位置:上下左右;
更多相关阅读请进入《Delphi》频道 >>