From 81b67bdebd8b0782a2f1236a144046a1bb3ee9f9 Mon Sep 17 00:00:00 2001 From: Epica3055 Date: Wed, 17 Sep 2025 11:03:13 +0800 Subject: [PATCH 1/2] fix #13873 [DarkMode]: TabControl doesn't render tab titles correctly when SizeMode = Fixed --- .../Windows/Forms/Controls/TabControl/TabControl.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/System.Windows.Forms/System/Windows/Forms/Controls/TabControl/TabControl.cs b/src/System.Windows.Forms/System/Windows/Forms/Controls/TabControl/TabControl.cs index 538d8724a9e..9629082e98d 100644 --- a/src/System.Windows.Forms/System/Windows/Forms/Controls/TabControl/TabControl.cs +++ b/src/System.Windows.Forms/System/Windows/Forms/Controls/TabControl/TabControl.cs @@ -767,7 +767,18 @@ public TabSizeMode SizeMode SourceGenerated.EnumValidator.Validate(value); _sizeMode = value; - RecreateHandle(); + + if (Application.IsDarkModeEnabled) + { + if (IsHandleCreated) + { + RecreateHandle(); + } + } + else + { + RecreateHandle(); + } } } From 6ba607bba7aa1d4a1521dea5df8143d1160ce726 Mon Sep 17 00:00:00 2001 From: Epica3055 Date: Fri, 19 Sep 2025 13:43:25 +0800 Subject: [PATCH 2/2] handle feedback --- .../Windows/Forms/Controls/TabControl/TabControl.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/System.Windows.Forms/System/Windows/Forms/Controls/TabControl/TabControl.cs b/src/System.Windows.Forms/System/Windows/Forms/Controls/TabControl/TabControl.cs index 9629082e98d..271eb6a40a9 100644 --- a/src/System.Windows.Forms/System/Windows/Forms/Controls/TabControl/TabControl.cs +++ b/src/System.Windows.Forms/System/Windows/Forms/Controls/TabControl/TabControl.cs @@ -768,14 +768,7 @@ public TabSizeMode SizeMode _sizeMode = value; - if (Application.IsDarkModeEnabled) - { - if (IsHandleCreated) - { - RecreateHandle(); - } - } - else + if (!Application.IsDarkModeEnabled || IsHandleCreated) { RecreateHandle(); }