unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, ComCtrls, StdCtrls;
type
TForm1 = class(TForm)
TreeView1: TTreeView;
Timer1: TTimer;
Memo1: TMemo;
procedure TreeView1MouseDown(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer);
procedure TreeView1DragOver(Sender, Source: TObject;
X, Y: Integer;
State: TDragState;
var Accept: Boolean);
procedure Timer1Timer(Sender: TObject);
private
oldtreeNode:TTreeNode;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.TreeView1MouseDown(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer);
begin
if button= mbRight then
Treeview1.begin
Drag(true);
end;
procedure TForm1.TreeView1DragOver(Sender, Source: TObject;
X, Y: Integer;
State: TDragState;
var Accept: Boolean);
begin
accept:=true;
if Treeview1.DropTarget<>OldTreeNode then
begin
oldTreeNode:=Treeview1.DropTarget ;
timer1.Enabled :=True;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if assigned(OldTreeNode) then
oldTreeNode.Expand(true);
memo1.Lines.add(oldtreeNode.text);
timer1.Enabled :=false;
end;
end.