搞定~~~
在FORM1上放一个ListView1,建立几个Items,一个ImageList1,ImageList1里面放几个图标~~
设置ListView1.LargeImages :=ImageList1;
procedure TForm1.ListView1DragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
accept:=Source is TlistView;
end;
procedure TForm1.ListView1DragDrop(Sender, Source: TObject; X, Y: Integer);
var
PosPoint:TPoint;
begin
PosPoint.x:=x;
PosPoint.y:=Y;
(Source As TListView).Selected.SetPosition(PosPoint);
end;
procedure TForm1.ListView1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if button=mbleft then
begin
with sender as TListview do
begin
if GetItemAt(x,y)<>nil then
begindrag(false);
end;
end;
end;
一切OK~~~