Change the Background color of TreeView

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sean

    Change the Background color of TreeView

    Hi all,

    I have a treeview and because I subclass the treeview and
    allow multiple selection to be done on the treeview, I
    have a problem changing the background color of the
    treeview.

    The problem is that after I multi-select the treenodes,
    and I try to change the background color of the treeview,
    those treenodes that have been multi-selected before still
    maintain the previous background color. The rest of the
    background change prefectly, only the bounds of those
    previously selected nodes do not change.

    I know that I can loop through all the nodes and change
    the background color of the nodes but I don't understand
    why this happens? Since everytime I reset the background
    color of the nodes, I use the value treeView.BackCo lor.

    Any suggestions will be greatly appreciated!
    Thank you in advance.



    regards,
    Sean
  • Tom Dacon

    #2
    Re: Change the Background color of TreeView

    I haven't tried this myself, so no guarantees, but it might be as simple as
    invalidating the rectangle that represents the client area of the treeview.
    Worth a try?

    HTH,
    Tom Dacon
    Dacon Software Consulting

    "Sean" <anonymous@disc ussions.microso ft.com> wrote in message
    news:383b01c471 c6$ab5defe0$a50 1280a@phx.gbl.. .[color=blue]
    > Hi all,
    >
    > I have a treeview and because I subclass the treeview and
    > allow multiple selection to be done on the treeview, I
    > have a problem changing the background color of the
    > treeview.
    >
    > The problem is that after I multi-select the treenodes,
    > and I try to change the background color of the treeview,
    > those treenodes that have been multi-selected before still
    > maintain the previous background color. The rest of the
    > background change prefectly, only the bounds of those
    > previously selected nodes do not change.
    >
    > I know that I can loop through all the nodes and change
    > the background color of the nodes but I don't understand
    > why this happens? Since everytime I reset the background
    > color of the nodes, I use the value treeView.BackCo lor.
    >
    > Any suggestions will be greatly appreciated!
    > Thank you in advance.
    >
    >
    >
    > regards,
    > Sean[/color]


    Comment

    • Guest's Avatar

      #3
      Re: Change the Background color of TreeView

      Hi Tom,

      Thank you for your reply.
      I have tried Invalidate, Refresh and Update
      but none of them worked... :(


      regards,
      Sean
      [color=blue]
      >-----Original Message-----
      >I haven't tried this myself, so no guarantees, but it[/color]
      might be as simple as[color=blue]
      >invalidating the rectangle that represents the client[/color]
      area of the treeview.[color=blue]
      >Worth a try?
      >
      >HTH,
      >Tom Dacon
      >Dacon Software Consulting
      >
      >"Sean" <anonymous@disc ussions.microso ft.com> wrote in[/color]
      message[color=blue]
      >news:383b01c47 1c6$ab5defe0$a5 01280a@phx.gbl. ..[color=green]
      >> Hi all,
      >>
      >> I have a treeview and because I subclass the treeview[/color][/color]
      and[color=blue][color=green]
      >> allow multiple selection to be done on the treeview, I
      >> have a problem changing the background color of the
      >> treeview.
      >>
      >> The problem is that after I multi-select the treenodes,
      >> and I try to change the background color of the[/color][/color]
      treeview,[color=blue][color=green]
      >> those treenodes that have been multi-selected before[/color][/color]
      still[color=blue][color=green]
      >> maintain the previous background color. The rest of the
      >> background change prefectly, only the bounds of those
      >> previously selected nodes do not change.
      >>
      >> I know that I can loop through all the nodes and change
      >> the background color of the nodes but I don't understand
      >> why this happens? Since everytime I reset the background
      >> color of the nodes, I use the value treeView.BackCo lor.
      >>
      >> Any suggestions will be greatly appreciated!
      >> Thank you in advance.
      >>
      >>
      >>
      >> regards,
      >> Sean[/color]
      >
      >
      >.
      >[/color]

      Comment

      Working...