From 4c05296226c56a1dc149673ce9b50a3648c0b073 Mon Sep 17 00:00:00 2001 From: "Simon Zhao (BEYONDSOFT CONSULTING INC)" Date: Wed, 11 Mar 2026 16:20:36 +0800 Subject: [PATCH 1/3] Fix issue 11954: [Dark Mode] ToolTip is not in dark mode after enabled SystemColorMode.Dark --- .../System/Windows/Forms/ToolTip/ToolTip.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/System.Windows.Forms/System/Windows/Forms/ToolTip/ToolTip.cs b/src/System.Windows.Forms/System/Windows/Forms/ToolTip/ToolTip.cs index 0078140bf83..b7e5522c12f 100644 --- a/src/System.Windows.Forms/System/Windows/Forms/ToolTip/ToolTip.cs +++ b/src/System.Windows.Forms/System/Windows/Forms/ToolTip/ToolTip.cs @@ -731,6 +731,11 @@ private unsafe void CreateHandle() // Setting the max width has the added benefit of enabling multiline tool tips. PInvokeCore.SendMessage(this, PInvoke.TTM_SETMAXTIPWIDTH, 0, SystemInformation.MaxWindowTrackSize.Width); + if (Application.IsDarkModeEnabled) + { + PInvoke.SetWindowTheme(HWND, $"{Control.DarkModeIdentifier}_{Control.ExplorerThemeIdentifier}", null); + } + if (_auto) { // AutomaticDelay property should overwrite other delay timer values, _auto field indicates that From 3887fee9b87db68e4a0b51bf4223e5e4f60fd817 Mon Sep 17 00:00:00 2001 From: "Simon Zhao (BEYONDSOFT CONSULTING INC)" Date: Thu, 12 Mar 2026 09:30:50 +0800 Subject: [PATCH 2/3] Apply suggestion to code --- .../System/Windows/Forms/ToolTip/ToolTip.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/System.Windows.Forms/System/Windows/Forms/ToolTip/ToolTip.cs b/src/System.Windows.Forms/System/Windows/Forms/ToolTip/ToolTip.cs index b7e5522c12f..de61cc33622 100644 --- a/src/System.Windows.Forms/System/Windows/Forms/ToolTip/ToolTip.cs +++ b/src/System.Windows.Forms/System/Windows/Forms/ToolTip/ToolTip.cs @@ -731,7 +731,8 @@ private unsafe void CreateHandle() // Setting the max width has the added benefit of enabling multiline tool tips. PInvokeCore.SendMessage(this, PInvoke.TTM_SETMAXTIPWIDTH, 0, SystemInformation.MaxWindowTrackSize.Width); - if (Application.IsDarkModeEnabled) + Form? activeForm = Form.ActiveForm; + if (Application.IsDarkModeEnabled && !SystemInformation.HighContrast && activeForm is not null && activeForm.DarkModeRequestState is true) { PInvoke.SetWindowTheme(HWND, $"{Control.DarkModeIdentifier}_{Control.ExplorerThemeIdentifier}", null); } From 9a3efbc6087b256125b547b49b58c4aa32cff34d Mon Sep 17 00:00:00 2001 From: "Simon Zhao (BEYONDSOFT CONSULTING INC)" Date: Thu, 12 Mar 2026 15:04:31 +0800 Subject: [PATCH 3/3] Fix issue --- .../System/Windows/Forms/ToolTip/ToolTip.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/System.Windows.Forms/System/Windows/Forms/ToolTip/ToolTip.cs b/src/System.Windows.Forms/System/Windows/Forms/ToolTip/ToolTip.cs index de61cc33622..4bdbb8da80d 100644 --- a/src/System.Windows.Forms/System/Windows/Forms/ToolTip/ToolTip.cs +++ b/src/System.Windows.Forms/System/Windows/Forms/ToolTip/ToolTip.cs @@ -718,6 +718,10 @@ private unsafe void CreateHandle() { PInvoke.SetWindowTheme(HWND, string.Empty, string.Empty); } + else if (Application.IsDarkModeEnabled) + { + PInvoke.SetWindowTheme(HWND, $"{Control.DarkModeIdentifier}_{Control.ExplorerThemeIdentifier}", null); + } } // If in OwnerDraw mode, we don't want the default border. @@ -731,12 +735,6 @@ private unsafe void CreateHandle() // Setting the max width has the added benefit of enabling multiline tool tips. PInvokeCore.SendMessage(this, PInvoke.TTM_SETMAXTIPWIDTH, 0, SystemInformation.MaxWindowTrackSize.Width); - Form? activeForm = Form.ActiveForm; - if (Application.IsDarkModeEnabled && !SystemInformation.HighContrast && activeForm is not null && activeForm.DarkModeRequestState is true) - { - PInvoke.SetWindowTheme(HWND, $"{Control.DarkModeIdentifier}_{Control.ExplorerThemeIdentifier}", null); - } - if (_auto) { // AutomaticDelay property should overwrite other delay timer values, _auto field indicates that