▼ Mr.XRAYさん
Drag and Drop サンプル、
procedure TForm1.TreeView1DragDrop(Sender, Source: TObject; X, Y: Integer);
var
WrkDestNode,
WrkSourceNode: TTreeNode;
NodeAttachMode: TNodeAttachMode;
begin
if Sender <> TreeView1 then
exit;
WrkDestNode := TreeView1.GetNodeAT(X, Y);
if Assigned( WrkDestNode ) = False then
exit;
if ((GetKeyState(VK_CONTROL) and $8000) <> 0)
or (TreeView1.TopItem = WrkDestNode) then
NodeAttachMode := naAddChild
else
NodeAttachMode := naInsert;
WrkSourceNode := TreeView1.Selected;
TreeView1.Items.BeginUpdate;
WrkSourceNode.MoveTo(WrkDestNode, NodeAttachMode);
TreeView1.Items.EndUpdate;
end;
|