Updating Ownerdraw Listbox When Objects Are Modified RRS feed

  • Question

  • Hi,

    I need to be able to change the colour of the strings in a Listbox dynamically but I'm getting too problems.

    First I've used 'standard' owner draw code for coloured strings that is all over the web. This works fine except that the draw (text) colour does not change when the item is selected. I'm wondering whath the best way is to deal with this, as the select highlighting is making the text illegible. Should I select different colours if item is selected or should I use an inverting drawing mode?

    Second. I've put objects in the Listbox. When the objects change then their colours may need to change. My problem is how to force the Listbox to redraw the item I've modified (I see other people have similar problems). Using Refresh() works but updates the wohle list - I'd prefer just to update the item. Is this possible with ListBox? Or should I really be using a single column ListView?


    Wednesday, February 21, 2007 11:17 AM