/// <summary>
        /// Draws a line of the content.
        /// </summary>
        /// <param name="e">Event arguments.</param>
        protected virtual void OnDrawLine(DrawNodeLineEventArgs e)
        {
            DrawLine?.Invoke(this, e);
            if (e.Handled)
            {
                return;
            }

            var eContent = new GetLineContentsEventArgs(e.Node, e.LineIndex, Color.Empty);

            OnGetLineContents(eContent);

            if (eContent.ShowBar)
            {
                // Free space indicator
                using (Brush bBarBack = new SolidBrush(BarBackColor))
                    using (Brush bBarFill = new SolidBrush(!eContent.Color.IsEmpty ? eContent.Color : eContent.BarPercentage > BarCriticalPercentage ? BarCriticalFillColor : BarFillColor))
                        using (Pen pBarBorder = new Pen(BarBorderColor))
                        {
                            e.Graphics.FillRectangle(bBarBack, e.Bounds);
                            e.Graphics.FillRectangle(bBarFill, new RectangleF(e.Bounds.Left, e.Bounds.Top, e.Bounds.Width * eContent.BarPercentage, e.Bounds.Height));
                            e.Graphics.DrawRectangle(pBarBorder, Utility.ToRectangle(e.Bounds));
                        }
            }
            else
            {
                using (Brush brush = new SolidBrush(!eContent.Color.IsEmpty ? eContent.Color : e.LineIndex == 0 ? ForeColor : DetailTextColor))
                    using (StringFormat stringFormat = new StringFormat())
                    {
                        e.Graphics.DrawString(eContent.Contents, Font, brush, e.Bounds, stringFormat);
                    }
            }
        }
        /// <summary>
        /// Paints the contents of the control.
        /// </summary>
        /// <param name="e">Event arguments.</param>
        protected virtual void OnDrawContents(DrawNodeEventArgs e)
        {
            DrawContents?.Invoke(this, e);
            if (e.Handled)
            {
                return;
            }

            var eLines = new GetLineCountEventArgs(e.Node);

            OnGetLineCount(eLines);

            int        lines      = eLines.LineCount;
            float      textHeight = GetTextHeight(e.Node);
            RectangleF iconRect   = new RectangleF(e.Bounds.Left + ContentPadding.Width, e.Bounds.Top + (e.Bounds.Height - ThumbnailSize.Height) / 2f,
                                                   ThumbnailSize.Width, ThumbnailSize.Height);
            RectangleF textRect = new RectangleF(e.Bounds.Left + ContentPadding.Width + ThumbnailSize.Width + ThumbnailTextSpacing, e.Bounds.Top + (e.Bounds.Height - textHeight) / 2f,
                                                 e.Bounds.Width - iconRect.Width - 2 * ContentPadding.Width - ThumbnailTextSpacing, textHeight);

            // Draw the image
            if (e.Node.Thumbnail != null)
            {
                Rectangle pos = Utility.GetSizedIconBounds(e.Node.Thumbnail, Utility.ToRectangle(iconRect), 0.0f, 0.5f);
                e.Graphics.DrawImage(e.Node.Thumbnail, pos);
            }

            // Draw item text
            RectangleF lineBounds = textRect;

            for (int i = 0; i < eLines.LineCount; i++)
            {
                var eHeight = new GetLineHeightEventArgs(e.Node, i);
                OnGetLineHeight(eHeight);
                float lineHeight = eHeight.LineHeight > 0 ? eHeight.LineHeight : Font.Height;
                lineBounds.Height = lineHeight;

                // Draw line of text
                DrawNodeLineEventArgs eLine = new DrawNodeLineEventArgs(e.Graphics,
                                                                        Utility.ToRectangle(lineBounds), e.Node, e.Enabled, e.Selected, e.Hovered, e.ControlHasFocus, i);
                OnDrawLine(eLine);

                // Offset the bounds to the next line below
                lineBounds.Offset(0, lineHeight + Font.Height * 0.2f);
            }
        }