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);
try BitBlt(Canvas.Handle,0,0,Width,Height,ScreenDC,Left,Top,SRCCOPY);
finally
ReleaseDC(0,ScreenDC);
end;
end;
end;
//Como usar:
//Image1.picture.Assign(CaptureScreenRect(Rect(0,0,Width,Height)));
Nenhum comentário:
Postar um comentário