IntegralUI TreeListView User Guide - Lidor Systems
IntegralUI TreeListView User Guide - Lidor Systems
IntegralUI TreeListView User Guide - Lidor Systems
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
.<strong>IntegralUI</strong>.Lists.<strong>TreeListView</strong>Node));<br />
// Get the target node (the one that is currently hovered)<br />
<strong>Lidor</strong><strong>Systems</strong>.<strong>IntegralUI</strong>.Lists.<strong>TreeListView</strong>Node targetNode =<br />
this.treeListView1.GetNodeAt(mousePos);<br />
// Suspend the treelistview layout to increase performance<br />
this.treeListView1.SuspendUpdate();<br />
// In Copy operation, create a clone node and then add it to the<br />
target<br />
if (e.Effect == DragDropEffects.Copy)<br />
node =<br />
(<strong>Lidor</strong><strong>Systems</strong>.<strong>IntegralUI</strong>.Lists.<strong>TreeListView</strong>Node)node.Clone();<br />
// Remove the node from its current parent node collection<br />
else<br />
node.Remove();<br />
end<br />
control<br />
mousePos);<br />
}<br />
}<br />
// If there is no target node, then add the dragged node at the<br />
if (targetNode == null)<br />
this.treeListView1.Nodes.Add(node);<br />
else<br />
{<br />
// Get the index of the dropped node in target <strong>TreeListView</strong><br />
}<br />
int newIndex = this.treeListView1.GetDropPos(targetNode,<br />
if (newIndex >= 0)<br />
{<br />
if (targetNode.Parent != null)<br />
targetNode.Parent.Nodes.Insert(newIndex, node);<br />
else<br />
this.treeListView1.Nodes.Insert(newIndex, node);<br />
}<br />
else<br />
targetNode.Nodes.Add(node);<br />
// Resume the treelistview layout and update the control<br />
this.treeListView1.ResumeUpdate();<br />
private void treeListView1_QueryContinueDrag(object sender,<br />
QueryContinueDragEventArgs e)<br />
{<br />
Point mousePos = this.treeListView1.PointToClient(Control.MousePosition);<br />
// Cancel the drag operation when the mouse cursor leaves the <strong>TreeListView</strong><br />
space<br />
if (!this.treeListView1.ClientRectangle.Contains(mousePos))<br />
e.Action = DragAction.Cancel;<br />
}<br />
50