Results 1 to 8 of 8

Thread: Get the highlight color of OS-styled ListView header in Windows 10 Explorer

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2014
    Posts
    94

    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?
    Name:  2020-05-18_10h21_34.png
Views: 482
Size:  2.7 KB
    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

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,302

    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.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2014
    Posts
    94

    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'.

  4. #4
    Fanatic Member Delaney's Avatar
    Join Date
    Nov 2019
    Location
    Paris, France
    Posts
    845

    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 ? Name:  color defined.JPG
Views: 309
Size:  25.7 KB
    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)

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Oct 2014
    Posts
    94

    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?

  6. #6
    Fanatic Member Delaney's Avatar
    Join Date
    Nov 2019
    Location
    Paris, France
    Posts
    845

    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)

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Oct 2014
    Posts
    94

    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.

  8. #8
    Fanatic Member Delaney's Avatar
    Join Date
    Nov 2019
    Location
    Paris, France
    Posts
    845

    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
  •  



Click Here to Expand Forum to Full Width