Krypton-Suite-Legacy-Archive / Krypton-NET-5.470

A update to Component factory's krypton toolkit to support the .NET 4.7 framework.
BSD 3-Clause "New" or "Revised" License
78 stars 20 forks source link

[New Feature Request]: Win10 dark mode scrollbars #236

Open PWagner1 opened 5 years ago

PWagner1 commented 5 years ago

Credit to @lathea for this info:

[DllImport("uxtheme.dll", ExactSpelling = true, CharSet = CharSet.Unicode)] private static extern int SetWindowTheme(IntPtr hwnd, string pszSubAppName, string pszSubIdList);

then override the HandleCreated() and put this in it: SetWindowTheme(Handle, "DarkMode_Explorer", null);

dark mode scroll bars! I've been stressing about this for a long time as the default scroll bars stick out a mile on any theme other than light. This has to be done on a control by control basis (ie KryptonTreeView, KryptonListBox)

It seems this may change as I am not sure how official it is. It works, even when win10 is in Light mode.

need to wrap the SetWindowTheme() call in an if that detects the current Krypton theme and then applies it or not depending on what looks best. It still looks odd for coloured themes, but at least a dark theme should be ok

Smurf-IV commented 4 years ago

Stick the call into VisualControlBase and anything that is using that (Most of the toolkit apart from some ribbons I recall) will get the switch as required.

Use something like OnGlobalPaletteChanged(...) to catch the pallete change and then set a flag. Use the flag and a call from within the constructor to set the call for the darkTheme mode for the scroll bars of that control.

Smurf-IV commented 4 years ago

OR, read up on the use of WM_CTLCOLORSCROLLBAR and on the use of WS_EX_LEFTSCROLLBAR or WS_VSCOLL to check if a VisualControlBase needs to have the scroll override applied. (via the use of WindowStylesHelper.HScrollBar)