From ee8a878e3be1fd73cbeb805e28a73d5f86a09590 Mon Sep 17 00:00:00 2001 From: "Simon Zhao (BEYONDSOFT CONSULTING INC)" Date: Tue, 7 Jul 2026 13:47:04 +0800 Subject: [PATCH 1/2] Fix issue 14025: [DarkMode] the item lost dot line when using the mouse to expand the dropdown panel for SelectionPanelRadioButton --- ...tionPanelBase.SelectionPanelRadioButton.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/System.Windows.Forms.Design/src/System/Drawing/SelectionPanelBase.SelectionPanelRadioButton.cs b/src/System.Windows.Forms.Design/src/System/Drawing/SelectionPanelBase.SelectionPanelRadioButton.cs index 569930b5389..1d836934681 100644 --- a/src/System.Windows.Forms.Design/src/System/Drawing/SelectionPanelBase.SelectionPanelRadioButton.cs +++ b/src/System.Windows.Forms.Design/src/System/Drawing/SelectionPanelBase.SelectionPanelRadioButton.cs @@ -9,6 +9,8 @@ internal abstract partial class SelectionPanelBase { protected class SelectionPanelRadioButton : RadioButton { + private const int WM_PAINT = 0x000F; + public SelectionPanelRadioButton() { AutoCheck = false; @@ -16,6 +18,26 @@ public SelectionPanelRadioButton() protected override bool ShowFocusCues => true; + protected override void WndProc(ref Message m) + { + base.WndProc(ref m); + + if (m.Msg != WM_PAINT || !Focused || !ShowFocusCues) + { + return; + } + + Rectangle focusBounds = ClientRectangle; + focusBounds.Inflate(-3, -3); + if (focusBounds.Width <= 0 || focusBounds.Height <= 0) + { + return; + } + + using Graphics g = CreateGraphics(); + ControlPaint.DrawFocusRectangle(g, focusBounds, ForeColor, BackColor); + } + protected override bool IsInputKey(Keys keyData) => keyData switch { Keys.Left or Keys.Right or Keys.Up or Keys.Down or Keys.Return => true, From 17659c604083ce842c59d82fa874dcbf6bc7e97d Mon Sep 17 00:00:00 2001 From: "Simon Zhao (BEYONDSOFT CONSULTING INC)" Date: Tue, 7 Jul 2026 14:21:23 +0800 Subject: [PATCH 2/2] Handle feedback --- .../Drawing/SelectionPanelBase.SelectionPanelRadioButton.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/System.Windows.Forms.Design/src/System/Drawing/SelectionPanelBase.SelectionPanelRadioButton.cs b/src/System.Windows.Forms.Design/src/System/Drawing/SelectionPanelBase.SelectionPanelRadioButton.cs index 1d836934681..f28c0afd11b 100644 --- a/src/System.Windows.Forms.Design/src/System/Drawing/SelectionPanelBase.SelectionPanelRadioButton.cs +++ b/src/System.Windows.Forms.Design/src/System/Drawing/SelectionPanelBase.SelectionPanelRadioButton.cs @@ -9,8 +9,6 @@ internal abstract partial class SelectionPanelBase { protected class SelectionPanelRadioButton : RadioButton { - private const int WM_PAINT = 0x000F; - public SelectionPanelRadioButton() { AutoCheck = false; @@ -22,13 +20,13 @@ protected override void WndProc(ref Message m) { base.WndProc(ref m); - if (m.Msg != WM_PAINT || !Focused || !ShowFocusCues) + if (m.MsgInternal != PInvokeCore.WM_PAINT || !Focused || !ShowFocusCues) { return; } Rectangle focusBounds = ClientRectangle; - focusBounds.Inflate(-3, -3); + focusBounds.Inflate(-LogicalToDeviceUnits(3), -LogicalToDeviceUnits(3)); if (focusBounds.Width <= 0 || focusBounds.Height <= 0) { return;