先把dragmode设成dmAutomaticprocedure TForm1.ListBox1DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); begin Accept := (Sender=Source);end;procedure TForm1.ListBox1DragDrop(Sender, Source: TObject; X, Y: Integer); begin with (Sender as TListBox) do Items.Move(ItemIndex,ItemAtPos(Point(x,y),True)); end;
State: TDragState; var Accept: Boolean);
begin
Accept := (Sender=Source);end;procedure TForm1.ListBox1DragDrop(Sender, Source: TObject; X, Y: Integer);
begin
with (Sender as TListBox) do
Items.Move(ItemIndex,ItemAtPos(Point(x,y),True)); end;