如何在屏幕上画图而不是在form上画?(100分)

  • 主题发起人 主题发起人 james.tane
  • 开始时间 开始时间
J

james.tane

Unregistered / Unconfirmed
GUEST, unregistred user!
如何在屏幕上画图而不是在form上画
 
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;
 
接受答案了.
 
var
c:tcanvas;
begin
c:=tcanvas.create;
try
c.handle:=getdc(0);//取得屏幕的dc;
c.ellipse(0,0,clientwidth,clientheight);
//还可以画其它图形;
finally
c.free;
end;
end;
 
后退
顶部