b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

bitblt sdk_bitblt_c# bitblt

电脑杂谈  发布时间:2017-02-12 05:04:37  来源:网络整理

bitblt_bitblt sdk_c# bitblt

bitbltbitblt

Delphi中BitBlt函数实现屏幕对象抓图

uses WinTypes, WinProcs, Forms, Controls, Classes, Graphics;

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;

思路是这样的

parameter 是一个 TRect, 也就是一个 4 方形,你可以设定,是这样的

TRect defines a rectangle.

Unit

Types

Delphi syntax:

type

TRect = packed record

case Integer of

0: (Left, Top, Right, Bottom: Integer);

1: (TopLeft, BottomRight: TPoint);

end;

返回一个 Bitmap 也就是图像拉

创建一个新的 bitmap instance

HDC 是一个 device context (DC),也就可以利用 BitBlt 把windows 图像转到 bitmap 里了。

完整代码在这里,朋友可以直接调用

bitblt_c# bitblt_bitblt sdk

unit ScrnCap;

intece

uses WinTypes, WinProcs, Forms, Controls, Classes, Graphics;

function CaptureScreenRect( ARect: TRect ): TBitmap;

function CaptureScreen: TBitmap;

function CaptureClientImage( Control: TControl ): TBitmap;

function CaptureControlImage( Control: TControl ): TBitmap;

function CaptureWindowImage( Wnd: HWND ): TBitmap;

implementation

{==============================================================================}

{ Use this to capture a rectangle on the screen... }

function CaptureScreenRect( ARect: TRect ): TBitmap;

{==============================================================================}

var

ScreenDC: HDC;

begin

Result := TBitmap.Create;

with Result, ARect do

begin

Width := Right - Left;


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-31929-1.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    • 张继先
      张继先

      地球动荡的根源国太源歇斯底里了

    • 昆贝
      昆贝

      腐败绝对使一棵大树颓然倒塌

    热点图片
    拼命载入中...