.NET version
.net6.0
Did it work in .NET Framework?
Yes
Did it work in any of the earlier releases of .NET Core or .NET 5+?
all
Issue description
After enabling dark mode, the scroll bar remains in the light theme.

private void button1_Click(object sender, EventArgs e)
{
Dark = !Dark;
}
bool dark = false;
public bool Dark
{
get => dark;
set
{
dark = value;
if (value)
{
BackColor = Color.Black;
ForeColor = Color.White;
}
else
{
BackColor = Color.White;
ForeColor = Color.Black;
}
int useImmersiveDarkMode = value ? 1 : 0;
DwmSetWindowAttribute(Handle, DWMWA_USE_IMMERSIVE_DARK_MODE, ref useImmersiveDarkMode, sizeof(int));
}
}
#region DarkDwm
[DllImport("dwmapi.dll")]
static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int attrValue, int attrSize);
const int DWMWA_USE_IMMERSIVE_DARK_MODE = 20;
#endregion
DarkTest.zip
Steps to reproduce
After invoking "Dark=true", the scroll bar color remains in the light theme.
.NET version
.net6.0
Did it work in .NET Framework?
Yes
Did it work in any of the earlier releases of .NET Core or .NET 5+?
all
Issue description
After enabling dark mode, the scroll bar remains in the light theme.
DarkTest.zip
Steps to reproduce
After invoking "Dark=true", the scroll bar color remains in the light theme.