-
May 18th, 2020, 02:41 AM
#1
Thread Starter
Lively Member
Get the highlight color of OS-styled ListView header in Windows 10 Explorer
Is there a way to retrieve the color used to highlight the hot column header under the mouse pointer in Windows 10 Explorer?
I tried to use the VisualStyleRenderer class for that but no luck:
Code:
Dim renderer As New VisualStyleRenderer(VisualStyleElement.Header.Item.Hot)
Dim hotColor As Color = renderer.GetColor(ColorProperty.FillColor)
The best result closest to the required color was ColorProperty.EdgeHighlightColor, but it is not exactly what I am looking for. The current highlight color is [R=217, G=235, B=249] in Windows 10 v1909, ColorProperty.EdgeHighlightColor returns [R=244, G=247, B=252].
I know I can draw the hot column header on a temporary bitmap and then try to retrieve the hot color using the GetPixel() method, but I think this is not a reliable way. Microsoft may change the hot background to a gradient or something like that in the future, but what I need is the solid color used to fill the hot column header.
Last edited by wisekat; May 18th, 2020 at 02:57 AM.
Reason: Added RGB color values
-
May 18th, 2020, 03:24 AM
#2
Re: Get the highlight color of OS-styled ListView header in Windows 10 Explorer
I would guess that it would be in the SystemColors class and probably the HotTrack property.
-
May 18th, 2020, 09:06 AM
#3
Thread Starter
Lively Member
Re: Get the highlight color of OS-styled ListView header in Windows 10 Explorer
Definitely not because the color I need is a color related to an item in a visual style. SystemColors returns colors I would call 'global system colors'.
-
May 18th, 2020, 09:47 AM
#4
Re: Get the highlight color of OS-styled ListView header in Windows 10 Explorer
The color may have no name so why not define the color and use it ?
Last edited by Delaney; May 18th, 2020 at 10:35 AM.
The best friend of any programmer is a search engine
"Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
“They did not know it was impossible so they did it” (Mark Twain)
-
May 18th, 2020, 10:30 AM
#5
Thread Starter
Lively Member
Re: Get the highlight color of OS-styled ListView header in Windows 10 Explorer
This is what I am doing now, but what if Microsoft will change something in its visual style later?
-
May 18th, 2020, 10:39 AM
#6
Re: Get the highlight color of OS-styled ListView header in Windows 10 Explorer
Why not use a totally different and personal color scheme ? As people can change the theme and personalize the colors in Windows, that will be a challenge unless it is written in the Windows Registry, in this case , you can try to find the value there.
Last edited by Delaney; May 18th, 2020 at 10:54 AM.
The best friend of any programmer is a search engine
"Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
“They did not know it was impossible so they did it” (Mark Twain)
-
May 19th, 2020, 10:40 AM
#7
Thread Starter
Lively Member
Re: Get the highlight color of OS-styled ListView header in Windows 10 Explorer
The problem is that I need to provide maximum visual compatibility with Windows 10.
-
May 19th, 2020, 02:02 PM
#8
Re: Get the highlight color of OS-styled ListView header in Windows 10 Explorer
If it is a requirement of your customer...In this case you will need to update your application with the new environment parameters of windows each time it is needed.
Why not put all these parameters (colors, size, anything) in a special file (env.ini or env.setup, etc) that you will read when the application will run. So in the future, you will have just to update the environment file.
The best friend of any programmer is a search engine
"Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
“They did not know it was impossible so they did it” (Mark Twain)
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|