Beispiel #1
0
        private int CalculateChildrenMaxWidthWithSize()
        {
            ITreeNodeSize size = (ITreeNodeSize)this;

            if (size.MaxWidth == 0)
            {
                if (this.Children.Count == 0)
                {
                    size.MaxWidth = 1;
                }
                else
                {
                    int childrenWidth = 0;

                    foreach (TNode child in this.Children)
                    {
                        childrenWidth += child.CalculateChildrenMaxWidthWithSize();
                    }

                    size.MaxWidth = Math.Max(size.MaxWidth, childrenWidth);
                }
            }

            return(size.MaxWidth);
        }
Beispiel #2
0
        private int CalculateChildrenMaxLevelWithSize()
        {
            ITreeNodeSize size = (ITreeNodeSize)this;

            if (size.MaxLevel == 0)
            {
                if (this.Children.Count == 0)
                {
                    size.MaxLevel = 1;
                }
                else
                {
                    foreach (TNode child in this.Children)
                    {
                        int childrenLevel = child.CalculateChildrenMaxLevelWithSize() + 1;

                        size.MaxLevel = Math.Max(size.MaxLevel, childrenLevel);
                    }
                }
            }

            return(size.MaxLevel);
        }