From 34cb3b862cd62b89cefa0543eace485efa51eb40 Mon Sep 17 00:00:00 2001 From: Frog Date: Wed, 27 May 2026 01:32:24 -0700 Subject: [PATCH] Fix Light Mode Selection Bar - Adjusts the selection bar so it properly selects the whole field. - Adjusted the color of the selection bar to be a lighter blue so text is easier to read. --- CreamInstaller/Components/CustomTreeView.cs | 27 ++++++++++++++++++++- CreamInstaller/Utility/ThemeManager.cs | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/CreamInstaller/Components/CustomTreeView.cs b/CreamInstaller/Components/CustomTreeView.cs index d37490a..47b8e36 100644 --- a/CreamInstaller/Components/CustomTreeView.cs +++ b/CreamInstaller/Components/CustomTreeView.cs @@ -162,7 +162,32 @@ internal sealed class CustomTreeView : TreeView } else { - e.DrawDefault = true; + if (highlighted && CheckBoxes) + { + // In light mode, take ownership of the row when selected so the + // highlight fills the full width (same approach as dark mode). + e.DrawDefault = false; + + Rectangle rowRect = new(0, node.Bounds.Top, ClientSize.Width, node.Bounds.Height); + graphics.FillRectangle(selectionBrush, rowRect); + + Font nodeFont = node.NodeFont ?? Font; + Color textColor = Enabled ? ForeColor : SystemColors.GrayText; + TextRenderer.DrawText(graphics, node.Text, nodeFont, + new Point(node.Bounds.Left, node.Bounds.Top + 1), textColor, TextFormatFlags.Default); + + CheckBoxState cbState = node.Checked + ? (Enabled ? CheckBoxState.CheckedNormal : CheckBoxState.CheckedDisabled) + : (Enabled ? CheckBoxState.UncheckedNormal : CheckBoxState.UncheckedDisabled); + Size cbSize = CheckBoxRenderer.GetGlyphSize(graphics, cbState); + Point cbPoint = new(node.Bounds.Left - cbSize.Width - 2, + node.Bounds.Top + node.Bounds.Height / 2 - cbSize.Height / 2); + CheckBoxRenderer.DrawCheckBox(graphics, cbPoint, cbState); + } + else + { + e.DrawDefault = true; + } } Font font = node.NodeFont ?? Font; diff --git a/CreamInstaller/Utility/ThemeManager.cs b/CreamInstaller/Utility/ThemeManager.cs index a640a71..4ab88e8 100644 --- a/CreamInstaller/Utility/ThemeManager.cs +++ b/CreamInstaller/Utility/ThemeManager.cs @@ -43,7 +43,7 @@ internal static class ThemeManager private static readonly Color LightPlatform = ColorTranslator.FromHtml("#696900"); private static readonly Color LightId = ColorTranslator.FromHtml("#006969"); private static readonly Color LightProxy = ColorTranslator.FromHtml("#006900"); - private static readonly Color LightSelectionBack = SystemColors.Highlight; + private static readonly Color LightSelectionBack = ColorTranslator.FromHtml("#ADD6FF"); private static readonly Color LightComboBack = SystemColors.Control; private static readonly Color LightComboBorder = SystemColors.ControlDark; private static readonly Color LightComboText = SystemColors.ControlText;