From 7f4fd96cff6b4a48473d656e4cc922df16406a3f Mon Sep 17 00:00:00 2001 From: "Simon Zhao (BEYONDSOFT CONSULTING INC)" Date: Fri, 29 May 2026 14:40:17 +0800 Subject: [PATCH] Fix dark mode text visibility in Collection Editor dialogs --- .../CollectionEditor.CollectionEditorCollectionForm.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/CollectionEditor.CollectionEditorCollectionForm.cs b/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/CollectionEditor.CollectionEditorCollectionForm.cs index 3ff13b95a9d..7ccbd0687a8 100644 --- a/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/CollectionEditor.CollectionEditorCollectionForm.cs +++ b/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/CollectionEditor.CollectionEditorCollectionForm.cs @@ -595,9 +595,12 @@ private void ListBox_drawItem(object? sender, DrawItemEventArgs e) if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) { backColor = SystemColors.Highlight; - textColor = SystemColors.HighlightText; + textColor = Application.IsDarkModeEnabled ? SystemColors.ControlText : SystemColors.HighlightText; } + using SolidBrush backBrush = new(SystemColors.Window); + g.FillRectangle(backBrush, button); + Rectangle res = e.Bounds with { X = e.Bounds.X + offset, Width = e.Bounds.Width - offset }; g.FillRectangle(new SolidBrush(backColor), res); if ((e.State & DrawItemState.Focus) == DrawItemState.Focus)