重载图片很慢吗? 你先把图片读到一个bitmap里,然后不断的用这个image.Picture.Assign这个bitmap就行了,一点也不慢,把image的parent.DoubleBuffered:=true,也不会闪
如果你觉得麻烦,建议你采用dreamisx的方法,方个shape,简单,还好控制,代码只需要写下面几句就行了
procedure TForm1.FormCreate(Sender: TObject);
begin
Shape1.Brush.Style:=bsClear;
end;
procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
Shape1.Left:=x-Shape1.Width shr 1;
Shape1.Top:=y-Shape1.Height shr 1;
end;
procedure TForm1.Shape1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
p:tpoint;
begin
with tshape(sender) do
begin
p:=clienttoparent(point(x,y));
SetBounds(p.x-Width shr 1,p.y-Height shr 1,width,height);
end;
end;