问题
Is it possible to change the color of the taskbar programmatically? I want to change the color to solid (opaque) black but ONLY for the taskbar (That's the reason why I can't use the DwmSetColorizationParameters
function. It changes the color for entire UI of Windows)
I am able to disable the transparency by finding the taskbar's hWnd
(FindWindow("Shell_TrayWnd", null);
) and setting the transparency by DWM API function DwmEnableBlurBehindWindow
but I don't know how to change the color.
回答1:
No, this isn't possible. The taskbar window doesn't have its own special color.
DWM sets the color for all windows, that's why you can modify it with the DWM APIs (albeit an undocumented, unsupported one). The taskbar is just a window. Nothing special.
Indeed, you can hack around with things like FindWindow
, but even putting aside the concerns about how inherently fragile that type of thing is, there's still no way to set a different glass color for an individual window.
Maybe you could look into creating your own theme? (Also officially unsupported.)
来源:https://stackoverflow.com/questions/34696332/change-the-taskbar-color-of-windows-10