Fix Dark Mode Expander / Selection Bar

- Fixes missing expander in dark mode, which occured when I was fixing the checkboxes. (Woops)
- Fixes the selection bar in dark mode, now properly selects the proxy button as well instead of being cut off. (Light mode still looks like shit though.)
This commit is contained in:
Frog
2026-05-27 01:28:28 -07:00
parent 593f396c54
commit 8040e6bcdb
+29 -2
View File
@@ -132,6 +132,33 @@ internal sealed class CustomTreeView : TreeView
int cbX = node.Bounds.Left - cbSize.Width - 2;
int cbY = node.Bounds.Top + node.Bounds.Height / 2 - cbSize.Height / 2;
ThemeManager.DrawDarkCheckBox(graphics, new Point(cbX, cbY), cbSize, node.Checked, Enabled);
// Expander glyph (expand/collapse) the system skips this when DrawDefault=false
if (node.Nodes.Count > 0)
{
int indent = Indent;
int level = node.Level;
int glyphSize = 13;
int glyphX = level * indent + (indent - glyphSize) / 2 + (ShowRootLines ? 0 : -indent);
int glyphY = node.Bounds.Top + node.Bounds.Height / 2 - glyphSize / 2;
Rectangle glyphRect = new(glyphX, glyphY, glyphSize, glyphSize);
Color glyphBorder = Color.FromArgb(0x6B, 0x6B, 0x6B);
Color glyphBack = Color.FromArgb(0x2D, 0x2D, 0x2D);
Color glyphFore = Color.FromArgb(0xD4, 0xD4, 0xD4);
using (SolidBrush backFill = new(glyphBack))
graphics.FillRectangle(backFill, glyphRect);
using (Pen borderPen = new(glyphBorder))
graphics.DrawRectangle(borderPen, glyphRect);
int mid = glyphY + glyphSize / 2;
int left = glyphX + 3;
int right = glyphX + glyphSize - 3;
using (Pen linePen = new(glyphFore))
{
graphics.DrawLine(linePen, left, mid, right, mid); // horizontal minus
if (!node.IsExpanded)
graphics.DrawLine(linePen, glyphX + glyphSize / 2, glyphY + 3, glyphX + glyphSize / 2, glyphY + glyphSize - 3); // vertical plus
}
}
}
else
{
@@ -209,7 +236,7 @@ internal sealed class CustomTreeView : TreeView
bounds = bounds with { X = bounds.X + bounds.Width, Width = size.Width };
selectionBounds = new(selectionBounds.Location, selectionBounds.Size + bounds.Size with { Height = 0 });
Rectangle checkBoxBounds = bounds;
graphics.FillRectangle(backBrush, bounds);
graphics.FillRectangle(brush, bounds);
point = new(bounds.Left, bounds.Top + bounds.Height / 2 - size.Height / 2 - 1);
if (dark)
ThemeManager.DrawDarkCheckBox(graphics, point, size, selection.UseProxy, Enabled);
@@ -222,7 +249,7 @@ internal sealed class CustomTreeView : TreeView
bounds = bounds with { X = bounds.X + bounds.Width, Width = size.Width + left };
selectionBounds = new(selectionBounds.Location, selectionBounds.Size + bounds.Size with { Height = 0 });
checkBoxBounds = new(checkBoxBounds.Location, checkBoxBounds.Size + bounds.Size with { Height = 0 });
graphics.FillRectangle(backBrush, bounds);
graphics.FillRectangle(brush, bounds);
point = new(bounds.Location.X - 1 + left, bounds.Location.Y + 1);
TextRenderer.DrawText(graphics, text, font, point,
Enabled ? ThemeManager.CustomTreeViewProxyColor : ThemeManager.CustomTreeViewDisabledProxyColor,