Skip to content

Commit c0dd9db

Browse files
author
Simon Zhao (BEYONDSOFT CONSULTING INC)
committed
Fixed an issue where the background color of checkboxes turned white after setting an image for a TreeView node.
1 parent 3634605 commit c0dd9db

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

  • src/System.Windows.Forms/System/Windows/Forms/Controls/TreeView

src/System.Windows.Forms/System/Windows/Forms/Controls/TreeView/TreeView.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,6 +1870,17 @@ protected override void OnHandleCreated(EventArgs e)
18701870
int style = (int)PInvokeCore.GetWindowLong(this, WINDOW_LONG_PTR_INDEX.GWL_STYLE);
18711871
style |= (int)PInvoke.TVS_CHECKBOXES;
18721872
PInvokeCore.SetWindowLong(this, WINDOW_LONG_PTR_INDEX.GWL_STYLE, style);
1873+
1874+
if (Application.IsDarkModeEnabled
1875+
&& DarkModeRequestState is true
1876+
&& RecreatingHandle)
1877+
{
1878+
_ = PInvoke.SetWindowTheme(
1879+
hwnd: HWND,
1880+
pszSubAppName: $"{DarkModeIdentifier}_{ExplorerThemeIdentifier}",
1881+
pszSubIdList: null);
1882+
}
1883+
18731884
UpdateCheckBoxImages();
18741885
}
18751886

0 commit comments

Comments
 (0)