procedure TActiveFormX.TreeView2DragDrop(Sender, Source: TObject
X,
Y: Integer);
begin
//要先把TreeView的DragMode设为dmAutomatic
(Sender as TTreeView).Items.AddChild((Sender as TTreeView).GetNodeAt(X,Y),(Source as TTreeView).Selected.Text);
// 拖动后可删除(Source as TTreeView).Items.Delete((Source as TTreeView).Selected)
//大体上是这样子做,还不支持拖动多层的结点。你还要改进一下。
end;
procedure TActiveFormX.TreeView2DragOver(Sender, Source: TObject
X,
Y: Integer
State: TDragState
var Accept: Boolean);
begin
if Source is TTreeView then Accept:=True;
end;