帅兄,刚刚调试完成的,基本满足你的要求:
1.不用image,listview;
2.不破坏原背景;
3.作直线运动.
如果满意,赶快发分。
unit draw;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
x1,y1:integer;
Form1: TForm1;
bmp1:tbitmap;
aicon:ticon;
i:integer=0;
rect1,rect2:trect;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
bmp1:=tbitmap.create;
AIcon:=ticon.Create;
aicon.loadfromfile('d:/borland/delphi4/lib/dedman.ico');
bmp1.width:=aicon.width;
bmp1.height:=aicon.height;
x1:=100;y1:=100;
form1.canvas.ellipse(90,90,150,150);
rect1.left:=x1;
rect1.top:=y1;
rect1.right:=x1+aicon.Width;
rect1.bottom:=y1+aicon.Height;
rect2.left:=0;
rect2.top:=0;
rect2.right:=bmp1.width;
rect2.bottom:=bmp1.height;
bmp1.canvas.CopyRect(rect2,form1.canvas,rect1);
form1.Canvas.Draw(x1,y1,aIcon);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
form1.canvas.draw(x1,y1+i,bmp1);
i:=i+1;
rect1.left:=x1;
rect1.top:=y1+i;
rect1.right:=x1+aicon.Width;
rect1.bottom:=y1+i+aicon.Height;
bmp1.canvas.CopyRect(rect2,form1.canvas,rect1);
form1.Canvas.Draw(x1,y1+i,aIcon);
end;
end.