查查ondrop事件的help,帮助中有例子的。

解决方案 »

  1.   

    给你一个例子
    比如窗体上有两个Listbox,下面将Listbox2中的项目拖到ListBox1中
    将两个Listbox的DragMode属性设为dmAutomatic.拖放经过事件
    procedure TForm1.ListBox1DragOver(Sender, Source: TObject; X, Y: Integer;
      State: TDragState; var Accept: Boolean);
    begin
      if TListBox(Source)=ListBox2 then
        Accept:=true;
    end;//拖放落下事件
    procedure TForm1.ListBox1DragDrop(Sender, Source: TObject; X, Y: Integer);
    begin
      ListBox1.Items.Add(Listbox2.Items[ListBox2.ItemIndex]);
    end;