diff --git a/src/System.Windows.Forms/System/Windows/Forms/Controls/Buttons/CheckBox.cs b/src/System.Windows.Forms/System/Windows/Forms/Controls/Buttons/CheckBox.cs index da9e1353c2b..57526b2644b 100644 --- a/src/System.Windows.Forms/System/Windows/Forms/Controls/Buttons/CheckBox.cs +++ b/src/System.Windows.Forms/System/Windows/Forms/Controls/Buttons/CheckBox.cs @@ -75,6 +75,13 @@ public Appearance Appearance using (LayoutTransaction.CreateTransactionIf(AutoSize, ParentInternal, this, PropertyNames.Appearance)) { _appearance = value; + + // UpdateOwnerDraw synchronizes control styles with the OwnerDraw state and recreates + // the handle if they differ. Since we hijack FlatStyle.Standard for DarkMode, the transition + // between Normal and Button appearance is critical for updating the OwnerDraw flag. + UpdateOwnerDraw(); + + // If handle wasn't recreated (OwnerDraw state didn't change), refresh the appearance. if (OwnerDraw) { Refresh(); @@ -82,11 +89,6 @@ public Appearance Appearance else { UpdateStyles(); - - // UpdateStyles should also update the UserDraw flag, but it doesn't. - // Since we hijack FlatStyle.Standard for DarkMode and let that SystemRender, - // the threshold from Normal to Button is important to update the OwnerDraw flag. - UpdateOwnerDraw(); } OnAppearanceChanged(EventArgs.Empty); diff --git a/src/System.Windows.Forms/System/Windows/Forms/Controls/Buttons/RadioButton.cs b/src/System.Windows.Forms/System/Windows/Forms/Controls/Buttons/RadioButton.cs index 1b04ac32b52..a6674f1ea69 100644 --- a/src/System.Windows.Forms/System/Windows/Forms/Controls/Buttons/RadioButton.cs +++ b/src/System.Windows.Forms/System/Windows/Forms/Controls/Buttons/RadioButton.cs @@ -89,6 +89,11 @@ public Appearance Appearance using (LayoutTransaction.CreateTransactionIf(AutoSize, ParentInternal, this, PropertyNames.Appearance)) { _appearance = value; + + // UpdateOwnerDraw checks if OwnerDraw state changed and calls RecreateHandle if needed. + UpdateOwnerDraw(); + + // If handle wasn't recreated (OwnerDraw state didn't change), refresh the appearance. if (OwnerDraw) { Refresh(); @@ -96,9 +101,6 @@ public Appearance Appearance else { UpdateStyles(); - - // UpdateStyles should also update the UserDraw flag, but it doesn't. - UpdateOwnerDraw(); } OnAppearanceChanged(EventArgs.Empty);