delphi 屏幕截屏


function GetScreenAll: TBitmap; // 截取全屏
var
 C: TCanvas;
begin
 C := TCanvas.Create;
 result := TBitmap.Create;
 result.Width  := Screen.Width;
 result.Height := Screen.Height;
 C.Handle := GetDC(0);  // 获取屏幕的设备上下文句柄,并拷贝
 result.Canvas.CopyRect(Rect(0, 0, screen.Width, screen.Height), C, Rect(0, 0, Screen.Width, SCreen.Height));
 ReleaseDC(0, C.Handle);
 C.Free;
end;

procedure TForm1.Button2Click(Sender: TObject);
var
 B: TBitmap;
begin
 B := TBitmap.Create;
 B := GetScreenAll();
 B.SaveToFile('d:\test2.bmp');
 b.Free;
end;

联系电话:
020-00000000
联系电话:
020-00000000
联系电话:
020-12345678