/// <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);
            }
        }
        /// <summary>
        /// Gets the minimum height of an item.
        /// </summary>
        /// <param name="node">The node to measure.</param>
        /// <returns>Minimum item height.</returns>
        public int GetTextHeight(FileSystemNode node)
        {
            var e = new GetLineCountEventArgs(node);

            OnGetLineCount(e);

            float textHeight = 0;

            for (int i = 0; i < e.LineCount; i++)
            {
                var eh = new GetLineHeightEventArgs(node, i);
                textHeight += eh.LineHeight > 0 ? eh.LineHeight : Font.Height;
            }

            textHeight += (e.LineCount - 1) * Font.Height * LineSpacing;

            return((int)textHeight);
        }
        /// <summary>
        /// Gets the minimum height of an item.
        /// </summary>
        /// <param name="node">The node to measure.</param>
        /// <returns>Minimum item height.</returns>
        public int GetItemHeight(FileSystemNode node)
        {
            var e = new GetLineCountEventArgs(node);

            OnGetLineCount(e);

            float textHeight = 0;

            for (int i = 0; i < e.LineCount; i++)
            {
                var eh = new GetLineHeightEventArgs(node, i);
                textHeight += eh.LineHeight > 0 ? eh.LineHeight : Font.Height;
            }

            textHeight += (e.LineCount - 1) * Font.Height * LineSpacing;
            float maxHeight = Math.Max(textHeight, ThumbnailSize.Height);

            return((int)(maxHeight + 2 * ContentPadding.Height));
        }
 /// <summary>
 /// Gets the line height of an item.
 /// </summary>
 /// <param name="e">Event arguments.</param>
 protected virtual void OnGetLineHeight(GetLineHeightEventArgs e)
 {
     GetLineHeight?.Invoke(this, e);
 }