From d80977d2a5546a73fae3900f52bf3d088775c124 Mon Sep 17 00:00:00 2001 From: "Simon Zhao (BEYONDSOFT CONSULTING INC)" Date: Wed, 8 Jul 2026 11:13:02 +0800 Subject: [PATCH 1/3] [DarkMode] the Pane in the Anchor Editor should adapt to the dark mode --- .../Forms/Design/AnchorEditor.AnchorUI.cs | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/AnchorEditor.AnchorUI.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/AnchorEditor.AnchorUI.cs index 24a88eaf1de..26230ffd20d 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/AnchorEditor.AnchorUI.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/AnchorEditor.AnchorUI.cs @@ -197,7 +197,15 @@ private class ControlPlaceholder : Control { public ControlPlaceholder() { - BackColor = SystemColors.Control; + if (Application.IsDarkModeEnabled) + { + BackColor = SystemColors.ControlDark; + } + else + { + BackColor = SystemColors.Control; + } + TabStop = false; SetStyle(ControlStyles.Selectable, false); } @@ -205,7 +213,16 @@ public ControlPlaceholder() protected override void OnPaint(PaintEventArgs e) { Rectangle rc = ClientRectangle; - ControlPaint.DrawButton(e.Graphics, rc, ButtonState.Normal); + + if (Application.IsDarkModeEnabled) + { + e.Graphics.FillRectangle(SystemBrushes.ControlDark, rc); + e.Graphics.DrawRectangle(SystemPens.WindowFrame, rc.X, rc.Y, rc.Width - 1, rc.Height - 1); + } + else + { + ControlPaint.DrawButton(e.Graphics, rc, ButtonState.Normal); + } } } From cbb2082bc7f8c1ce2f7fcc05715eacd817acdc08 Mon Sep 17 00:00:00 2001 From: "Simon Zhao (BEYONDSOFT CONSULTING INC)" Date: Fri, 10 Jul 2026 11:20:05 +0800 Subject: [PATCH 2/3] Handle feedback --- .../System/Windows/Forms/Design/AnchorEditor.AnchorUI.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/AnchorEditor.AnchorUI.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/AnchorEditor.AnchorUI.cs index 26230ffd20d..6840e50d216 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/AnchorEditor.AnchorUI.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/AnchorEditor.AnchorUI.cs @@ -213,15 +213,10 @@ public ControlPlaceholder() protected override void OnPaint(PaintEventArgs e) { Rectangle rc = ClientRectangle; - + ControlPaint.DrawButton(e.Graphics, rc, ButtonState.Normal); if (Application.IsDarkModeEnabled) { - e.Graphics.FillRectangle(SystemBrushes.ControlDark, rc); - e.Graphics.DrawRectangle(SystemPens.WindowFrame, rc.X, rc.Y, rc.Width - 1, rc.Height - 1); - } - else - { - ControlPaint.DrawButton(e.Graphics, rc, ButtonState.Normal); + e.Graphics.FillRectangle(new SolidBrush(BackColor), rc); } } } From fa86029645c136bf1f36a732a8c38f784ff16555 Mon Sep 17 00:00:00 2001 From: "Simon Zhao (BEYONDSOFT CONSULTING INC)" Date: Fri, 10 Jul 2026 11:24:41 +0800 Subject: [PATCH 3/3] Method for updating the fill control --- .../src/System/Windows/Forms/Design/AnchorEditor.AnchorUI.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/AnchorEditor.AnchorUI.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/AnchorEditor.AnchorUI.cs index 6840e50d216..7a6bdba3e35 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/AnchorEditor.AnchorUI.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/AnchorEditor.AnchorUI.cs @@ -216,7 +216,7 @@ protected override void OnPaint(PaintEventArgs e) ControlPaint.DrawButton(e.Graphics, rc, ButtonState.Normal); if (Application.IsDarkModeEnabled) { - e.Graphics.FillRectangle(new SolidBrush(BackColor), rc); + e.Graphics.Clear(BackColor); } } }