procedure TForm1.Button1Click(Sender: TObject);
var
ACanvas: TCanvas;
DC: HDC;
ABmp: TBitmap;
begin
ABmp := TBitmap.Create;
try
ABmp.LoadFromFile('d:/photo/32pic02.BMP');
DC := GetDC(0);
try
ACanvas := TCanvas.Create;
try
ACanvas.Handle := DC;
ACanvas.CopyRect(Rect(0, 0, Screen.Width, Screen.Height),
ABmp.Canvas,
Rect(0, 0, ABmp.Width, ABmp.Height));
finally
ACanvas.Free;
end;
finally
ReleaseDC(0, DC);
end;
finally
ABmp.Free;
end;
end;