Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. listview selected row is light grey when control loses focus, not deep blue

listview selected row is light grey when control loses focus, not deep blue

Scheduled Pinned Locked Moved Visual Basic
question
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jim Dolson
    wrote on last edited by
    #1

    When an row in a ListBox is selected, it is highlighted a nice deep blue. If that ListBox loses focus, the ListBox's selected row remains highlighted in blue. However, when a ListView loses focus (and it's HideSelection property is set to false), although the selected rows remain highlighted, the highlight is no longer a nice deep blue but rather a barely visible light grey. Is there a way to change the highlighted color of ListView's selected row when the ListView no longer has focus? Thanks,

    Jim Dolson

    D L 2 Replies Last reply
    0
    • J Jim Dolson

      When an row in a ListBox is selected, it is highlighted a nice deep blue. If that ListBox loses focus, the ListBox's selected row remains highlighted in blue. However, when a ListView loses focus (and it's HideSelection property is set to false), although the selected rows remain highlighted, the highlight is no longer a nice deep blue but rather a barely visible light grey. Is there a way to change the highlighted color of ListView's selected row when the ListView no longer has focus? Thanks,

      Jim Dolson

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      The control is using the system colors to paint itself. If you want to change the colors it's using, you'll have to paint the control yourself. C# Custom Paint ListView[^]

      A guide to posting questions on CodeProject

      How to debug small programs
      Dave Kreskowiak

      1 Reply Last reply
      0
      • J Jim Dolson

        When an row in a ListBox is selected, it is highlighted a nice deep blue. If that ListBox loses focus, the ListBox's selected row remains highlighted in blue. However, when a ListView loses focus (and it's HideSelection property is set to false), although the selected rows remain highlighted, the highlight is no longer a nice deep blue but rather a barely visible light grey. Is there a way to change the highlighted color of ListView's selected row when the ListView no longer has focus? Thanks,

        Jim Dolson

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        In addition to Dave's answer, it's usually not worth the effort. Unless you use the highlight-color as defined in the system-colors, your blue would default to red on my desktop :) If it's merely to get consistency then do consider the fact that you are adding code that might throw exceptions/have bugs, while the only advantage is color-consistency (one that is still a non-default, and hence, unexpected) If you are letting the user make a selection, then you could consider using checkboxes to indicate the selection.

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

        J 1 Reply Last reply
        0
        • L Lost User

          In addition to Dave's answer, it's usually not worth the effort. Unless you use the highlight-color as defined in the system-colors, your blue would default to red on my desktop :) If it's merely to get consistency then do consider the fact that you are adding code that might throw exceptions/have bugs, while the only advantage is color-consistency (one that is still a non-default, and hence, unexpected) If you are letting the user make a selection, then you could consider using checkboxes to indicate the selection.

          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

          J Offline
          J Offline
          Jim Dolson
          wrote on last edited by
          #4

          Thank you gentlemen. I've decided to leave the default behavior alone. Jim

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups