procedure TForm1.Button10Click(Sender: TObject);
var
bmp: TBitmap;
can: TCanvas;
dc: HDC;
Image1: TImage;
begin
try
Image1:=TImage.Create(self);
bmp := TBitmap.Create; //创建BMP
bmp.Width := Screen.Width; //把屏幕属性赋值
bmp.Height := Screen.Height; //赋值屏幕
dc := GetDC(0); //获取到屏幕的dc
can := TCanvas.Create; //创建画布对象
can.Handle := dc;
bmp.Canvas.CopyRect(Rect(0, 0, Screen.Width, Screen.Height), can, Rect(0, 0, Screen.Width, Screen.Height));
Image1.Picture.Bitmap := bmp; //将截取到的图片显示在iamge控件中
Image1.Picture.SaveToFile(ExtractFilePath(Application.ExeName) + 'photo.jpg');
finally
bmp.Free;
can.Free;
Image1.Free;
ReleaseDC(0, dc);
end;
end;