Treelist父节点上下移

         /// <summary>
        /// 节点上移
        /// </summary>
        /// <param name="node"></param>
        private void SetTreeNodeUp(TreeListNode node)
        {
            if(node == null)
            {
                return;
            }
            var parent = node.ParentNode;
            if (parent == null)
            {
                var index = trlsMonitor.GetNodeIndex(node);
                trlsMonitor.SetNodeIndex(node, index - 1);
            }
            else
            {
                var index = trlsMonitor.GetNodeIndex(parent);
                trlsMonitor.SetNodeIndex(parent, index - 1);
            }
        }
    
 /// <summary>
        /// 节点下移
        /// </summary>
        /// <param name="node"></param>
        private void SetTreeNodeDown(TreeListNode node)
        {
            if (node == null)
            {
                return;
            }
            var parent = node.ParentNode;
            if (parent == null)
            {
                var index = trlsMonitor.GetNodeIndex(node);
                trlsMonitor.SetNodeIndex(node, index + 1);
            }
            else
            {
                var index = trlsMonitor.GetNodeIndex(parent);
                trlsMonitor.SetNodeIndex(parent, index + 1);
            }
        }

 

posted @ 2020-10-15 10:51  舒碧  阅读(283)  评论(0编辑  收藏  举报