-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dark scrollbars #6
Comments
That's a good question. I remember seeing some light scrollbars in WPF but haven't looked at Windows Forms yet. I'll check to see if the Win32 demo has dark scrollbars. |
I'm not exactly sure what C++ nonsense this is, but it looks like void FixDarkScrollBar()
{
HMODULE hComctl = LoadLibraryExW(L"comctl32.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
if (hComctl)
{
auto addr = FindDelayLoadThunkInModule(hComctl, "uxtheme.dll", 49); // OpenNcThemeData
if (addr)
{
DWORD oldProtect;
if (VirtualProtect(addr, sizeof(IMAGE_THUNK_DATA), PAGE_READWRITE, &oldProtect))
{
auto MyOpenThemeData = [](HWND hWnd, LPCWSTR classList) -> HTHEME {
if (wcscmp(classList, L"ScrollBar") == 0)
{
hWnd = nullptr;
classList = L"Explorer::ScrollBar";
}
return _OpenNcThemeData(hWnd, classList);
};
addr->u1.Function = reinterpret_cast<ULONG_PTR>(static_cast<fnOpenNcThemeData>(MyOpenThemeData));
VirtualProtect(addr, sizeof(IMAGE_THUNK_DATA), oldProtect, &oldProtect);
}
}
}
} I have no idea how to do this in C#, but I might try to give it a shot. |
@AndnixSH
example to dark scrollbar and treeView https://www.mediafire.com/file/4m0uieavnkityje/DarkWinForm.zip/file |
Oh wow thanks, that's way easier than the I'll try to see if there's a good way to handle this automatically in this library, but at the very least, this method can be called manually (either directly by the dependent UI app, or proxied by this library for convenience). |
…ifferent windows? [appears to work, API is neither documented nor finalized]
@Aldaviva
2023-08-20_20-22-57.mp4 |
Thanks, let me try that out! I'm definitely not a Forms expert so I appreciate the assistance. |
@memoarfaa that's nice. Would it support buttons, textboxes and dropdowns too, like how Notepad++ and foobar2000 implemented them? |
|
Nice, I'll take a look at that. |
Do you know if it's possible to enable dark scrollbars natively in WinForm? Notepad++ and Windows Explorer are using native dark scrollbars
The text was updated successfully, but these errors were encountered: