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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. ListViewItem color issues

ListViewItem color issues

Scheduled Pinned Locked Moved C#
csharpvisual-studiohelpquestion
3 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.
  • A Offline
    A Offline
    Aaron Dilliard
    wrote on last edited by
    #1

    On many of my applications I make use of a ListView control, that has a certain color displayed on the column that is currently sorted. It also highlights rows for special things. In .NET 1.1 this worked perfectly, but whenever I try to import an app into .NET 2.0 (VS 2005) the color highlights only show up when the form loses focus and gets it back. If you scroll, the items lose the color. This also happens when the SelectedIndex changes and the highlight is given to a new row. The previously selected row loses color. As I said before, the only way to get back the color is for the form to lose focus and regain it. Is the ListView drawn differently in .NET 2.0? Anyone else had this issue? Thanks in advance Aaron

    E 1 Reply Last reply
    0
    • A Aaron Dilliard

      On many of my applications I make use of a ListView control, that has a certain color displayed on the column that is currently sorted. It also highlights rows for special things. In .NET 1.1 this worked perfectly, but whenever I try to import an app into .NET 2.0 (VS 2005) the color highlights only show up when the form loses focus and gets it back. If you scroll, the items lose the color. This also happens when the SelectedIndex changes and the highlight is given to a new row. The previously selected row loses color. As I said before, the only way to get back the color is for the form to lose focus and regain it. Is the ListView drawn differently in .NET 2.0? Anyone else had this issue? Thanks in advance Aaron

      E Offline
      E Offline
      Ed Poore
      wrote on last edited by
      #2

      Aaron Dilliard wrote:

      Is the ListView drawn differently in .NET 2.0?

      I don't think there are any major changes that would break an app.

      Aaron Dilliard wrote:

      Anyone else had this issue?

      Nope My guess is that you're not handling it as well as you could be.  Are you deriving from the ListView control and overriding the OnDrawItem method or are you handling the events.  If you're handling the events I'd try overriding the method in a custom control. Sorry I'm not of any further help

      A 1 Reply Last reply
      0
      • E Ed Poore

        Aaron Dilliard wrote:

        Is the ListView drawn differently in .NET 2.0?

        I don't think there are any major changes that would break an app.

        Aaron Dilliard wrote:

        Anyone else had this issue?

        Nope My guess is that you're not handling it as well as you could be.  Are you deriving from the ListView control and overriding the OnDrawItem method or are you handling the events.  If you're handling the events I'd try overriding the method in a custom control. Sorry I'm not of any further help

        A Offline
        A Offline
        arow69d
        wrote on last edited by
        #3

        I agree that there are no major changes that would break an app, but even subtle changes in the way the control is drawn could have an effect on 1.1 code. IE, if a WM_PRINT message is sent with the ERASEBACKGROUND flag or something like that, that could be the culprit. I know Microsoft changed the control some in 2.0, and Ill bet that is what is going on. I will just have to rework the code. Thanks for the input. Aaron

        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