diff --git a/CreamInstaller/Components/CustomTreeView.cs b/CreamInstaller/Components/CustomTreeView.cs index 2ec2971..d37490a 100644 --- a/CreamInstaller/Components/CustomTreeView.cs +++ b/CreamInstaller/Components/CustomTreeView.cs @@ -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,