Ejemplo n.º 1
0
            public void RenderTreeNode( Graphics g, SuperTree.ITreeInfo treeInfo, SuperTree.TreeNode treeNode, Rectangle nodeRectangle, Rectangle clip )
            {
                UnsetAnimateGlow( treeNode );
                UnsetAnimateMark( treeNode );

                bool isLast = (treeNode.Index == treeNode.ParentCollection.Count - 1);
                Point ecCenter = new Point( nodeRectangle.X + _leftSep + _ecSize / 2, nodeRectangle.Y + (nodeRectangle.Height - _ecSize) / 2 + _ecSize / 2 );

                int textX = nodeRectangle.X + _ecSize + _leftSep + _ecSep;

                bool isSelected = treeInfo.IsSelected( treeNode );

                Rectangle bgRect = new Rectangle( nodeRectangle.X + _ecSize + _ecSep, nodeRectangle.Y, nodeRectangle.Width - _ecSize - 8, nodeRectangle.Height - 1 );
                SuperTree.TreeNode mouseOver;
                Point nodePosition;

                treeInfo.GetMouseOver( out mouseOver, out nodePosition );

                _nodeUpdates.DoneUpdate( treeNode );

                double nodeGlow = GetNodeFade( treeNode );

                if( isSelected || nodeGlow > 0 )
                {
                    RenderNode( g, treeInfo, treeNode, bgRect, isSelected, nodeGlow );
                }

                if( treeNode.Icon != null )
                {
                    Image image = GetImage( treeNode.Icon );
                    Rectangle imageRect = new Rectangle( textX, nodeRectangle.Y + 1, image.Width, image.Height );

                    if( clip.IntersectsWith( imageRect ) )
                    {
                        g.DrawImageUnscaled( image, imageRect );
                    }

                    textX += image.Width + _imageSep;
                }

                Color textColor;
                Rectangle textRect = new Rectangle( textX + 2, nodeRectangle.Y + _verticalSep, nodeRectangle.Right - textX - 5, nodeRectangle.Height );

                if( isSelected )
                {
                    if( _treeControl.Focused )
                    {
                        textColor = _colorTable.GlowTextColor;
                    }
                    else
                    {
                        textColor = _colorTable.TextColor;
                    }
                }
                else
                {
                    textColor = SystemColors.ControlText;
                }

                if( clip.IntersectsWith( textRect ) )
                {
                    WinFormsUtility.Drawing.GdiPlusEx.DrawString
                        ( g, treeNode.Text, treeNode.Font, textColor
                        , textRect
                        , WinFormsUtility.Drawing.GdiPlusEx.TextSplitting.SingleLineEllipsis, WinFormsUtility.Drawing.GdiPlusEx.Ampersands.Display );
                }

                Rectangle ecRect = new Rectangle( nodeRectangle.X, nodeRectangle.Y, 10, 10 );

                if( clip.IntersectsWith( ecRect ) )
                {
                    if( treeNode.ChildNodes.Count > 0 )
                    {
                        RenderExpansionMark( g, treeInfo, treeNode, nodeRectangle );
                    }
                }
            }