Skip to content
This repository has been archived by the owner on Jan 16, 2022. It is now read-only.

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

Open
PWagner1 opened this issue Oct 7, 2019 · 2 comments
Open

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

PWagner1 opened this issue Oct 7, 2019 · 2 comments

Comments

@PWagner1
Copy link
Collaborator

PWagner1 commented Oct 7, 2019

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
Copy link
Collaborator

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
Copy link
Collaborator

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)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants