close
//uses jpeg
procedure TForm1.Button1Click(Sender: TObject);
var
DC: HDC;
Canvas: TCanvas;
MyBitmap: TBitmap;
jpg: TJpegimage;
begin
Canvas := TCanvas.Create;
MyBitmap := TBitmap.Create;
DC := GetDC(0);
jpg := TJpegImage.Create;
try
Canvas.Handle := DC;
with Screen do
begin
MyBitmap.Width := Width;
MyBitmap.Height := Height;
MyBitmap.Canvas.CopyRect(
Rect(0, 0, Width, Height), Canvas,
Rect(0, 0, Width, Height));
jpg.Assign(MyBitmap);
jpg.SaveToFile('1.jpg');
end;
finally
{ free memory }
ReleaseDC(0, DC);
MyBitmap.Free;
Canvas.Free;
jpg.Free;
end;
end;
文章標籤
全站熱搜
留言列表