painttreenodecollection.cs

来自「破解的飞信源代码」· CS 代码 · 共 90 行

CS
90
字号
namespace Imps.Client.Pc.BizControls
{
    using System;
    using System.Collections;
    using System.Reflection;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    public class PaintTreeNodeCollection : CollectionBase
    {
        public event NodeAdded OnNodeAdded;

        public event NodeClear OnNodeClear;

        public event NodeCount OnNodeCount;

        public event NodeGot OnNodeGot;

        public event NodeInserted OnNodeInserted;

        public event NodeRemoveAt OnNodeRemove;

        public int Add(PaintTreeNode node)
        {
            node.Text = "";
            node.PaintTreeNodeBounds = node.Bounds;
            return this.Add((TreeNode) node);
        }

        public int Add(TreeNode node)
        {
            return this.OnNodeAdded(node);
        }

        public virtual void AddRange(TreeNode[] nodes)
        {
            if (nodes == null)
            {
                throw new ArgumentNullException("nodes");
            }
            foreach (TreeNode node in nodes)
            {
                this.Add(node);
            }
        }

        public void Clear()
        {
            this.OnNodeClear();
        }

        public int Insert(int index, PaintTreeNode node)
        {
            return this.Insert(index, node);
        }

        public int Insert(int index, TreeNode node)
        {
            return this.OnNodeInserted(index, node);
        }

        public virtual void Remove(TreeNode node)
        {
            this.OnNodeRemove(node.Index);
        }

        public void RemoveAt(int index)
        {
            this.OnNodeRemove(index);
        }

        public int Count
        {
            get
            {
                return this.OnNodeCount();
            }
        }

        public TreeNode this[int index]
        {
            get
            {
                return this.OnNodeGot(index);
            }
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?