Source/AdvTree/NodeOperations.cs

(开头部分) 47KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Drawing;
using System.Text;
using DevComponents.AdvTree.Display;
using System.Collections;

namespace DevComponents.AdvTree
{
	/// <summary>
	/// Represents node operations.
	/// </summary>
	internal class NodeOperations
	{
		/// <summary>
		/// Returns full path to the given node.
		/// </summary>
		/// <param name="node">Node to return path to.</param>
		/// <returns>Full path to the node.</returns>
		public static string GetFullPath(Node node,string pathSeparator)
		{
			if(node==null)
				throw new ArgumentNullException("node");
			
			StringBuilder sb=new StringBuilder(node.Text);
			node=node.Parent;
			while(node!=null)
			{
                sb.Insert(0, node.Text + pathSeparator);
				node=node.Parent;
			}

			return sb.ToString();
		}

		/// <summary>
		/// Gets the last child tree node. The LastNode is the last child Node in the NodeCollection stored in the Nodes property of the current tree node. If the Node has no child tree node, the LastNode property returns a null reference (Nothing in Visual Basic).
		/// </summary>
		/// <param name="node">Reference node.</param>
		/// <returns>Last node if found or null if there is no last node.</returns>
		public static Node GetLastNode(Node node)
		{
			if(node.Nodes.Count>0)
			{
				return node.Nodes[node.Nodes.Count-1];
			}
			return null;
		}

        /// <summary>
        /// Returns last rendered node on screen.
        /// </summary>
        /// <param name="tree">Tree control.</param>
        /// <returns>Last rendered node or null</returns>
        public static Node GetLastDisplayedNode(AdvTree tree)
        {
            Rectangle r = tree.ClientRectangle;
            Node node = tree.SelectedNode;
            if (node == null) node = GetFirstVisibleNode(tree);
            Point scrollPos = Point.Empty;
            if (tree.AutoScroll)
后面还有 1304 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。