/// <summary>
        /// Paints the background of the item.
        /// </summary>
        /// <param name="e">Event arguments.</param>
        protected virtual void OnDrawBackground(DrawNodeEventArgs e)
        {
            DrawBackground?.Invoke(this, e);
            if (e.Handled)
            {
                return;
            }

            using (Brush back = new SolidBrush(!e.Enabled ? DisabledBackColor :
                                               !e.ControlHasFocus && e.Selected ? UnfocusedItemBackColor :
                                               e.Selected?SelectedItemBackColor:
                                               e.Hovered ? HoveredItemBackColor : BackColor))
            {
                e.Graphics.FillRectangle(back, e.Bounds);
            }
        }
Ejemplo n.º 2
0
 internal static void OnDrawBackground() => DrawBackground?.Invoke();