1. 程式人生 > >DevExpress Treelist 同一個樹上拖動 改變順序

DevExpress Treelist 同一個樹上拖動 改變順序

using DevExpress.XtraTreeList;

using DevExpress.XtraTreeList.Nodes;

private void treeList1_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
 {
    TreeListNode dragNode, targetNode;
    TreeList tl = sender as TreeList;
    Point p = tl.PointToClient(new Point(e.X, e.Y));
    dragNode = e.Data.GetData(typeof(TreeListNode)) as TreeListNode;
    targetNode = tl.CalcHitInfo(p).Node;
    tl.SetNodeIndex(dragNode, tl.GetNodeIndex(targetNode));
}

 

轉載於 https://www.cnblogs.com/HedgehogBlog/p/5764339.html