Board index » delphi » Colors in a TV-Listbox

Colors in a TV-Listbox

Hi everybody!

I've written a program, which has a listbox. You can select Items and
read (by double-click) little articels.

Now my questions:

- How can I put some colors in the listbox (i.e: for each articel (8)
an other color)

Reply please with e-Mail

Thanx

Kostja

 

Re:Colors in a TV-Listbox


Kostja,

Quote
>- How can I put some colors in the listbox (i.e: for each articel (8)
>an other color)

If I recall right the ListBox uses a GetColor function for each line it
want's to display. That's the point where you have to add your code. Check
if it is an item you want to highlight and then return the color. With this
you can just change the color for each line. If you want to change the
color for just one string in a line it will become a little bit more
complicated. You'll have to make some changes in the Draw methode. After
the TDrawBuffer was completly setted up for a line you have to rescan it
and change the colors for the string (the colors are the high bytes of each
word). This have to be done before you call WriteStr.

Sincerely, Tom
--
Tom Wellige
well...@itk.de
http://www.kst.dit.ie/people/twellige

Other Threads