Board index » delphi » Listbox, different colors on itemlines

Listbox, different colors on itemlines

Best Delphians
I'd like to mark single lines i a listbox with a differing color.
(The property Color acts on the entire listbox.)
Anyone of you knows about appropriate methods. I have a wague feeling
that the Rect could be used. But how?
I really appreciate any points of view!
/ Kurt
----------------------------------------------------------------------
Kurt.Anneb...@mailbox.swipnet.se
Kandex System Development, Link?ping. Sweden
======================================================================
 

Re:Listbox, different colors on itemlines


Quote
>I'd like to mark single lines i a listbox with a differing color.
>(The property Color acts on the entire listbox.)
>Anyone of you knows about appropriate methods. I have a wague feeling
>that the Rect could be used. But how?

Use an ownerdraw listbox. (see "ownerdraw" in your doc index)

David

--
David Brabant,             | E-mail: David.Brab...@csl.sni.be
Siemens Nixdorf (SNI),     | CIS:    100337,1733
Centre Software de Lige,  | X-400:  C=BE;A=RTT;P=SCN;O=SNI;OU1=LGG1;OU2=S1
2, rue des Fories,         |         S=BRABANT;G=DAVID
4020 Lige (BELGIUM)       | HTTP:   www.sni.de       www.csl.sni.be/~david

Re:Listbox, different colors on itemlines


Kurt <m-14...@mailbox.swipnet.se>,

Quote
>I'd like to mark single lines i a listbox with a differing color.
>(The property Color acts on the entire listbox.)
>Anyone of you knows about appropriate methods. I have a wague feeling
>that the Rect could be used. But how?
>I really appreciate any points of view!

  There is an OnDrawItem event where you can change the
ListBox.Canvas.Font.Color to whatever you want for that particular item.
 You could even change the font style or whatever.

Good Luck,

-Ed Salgado
 Eminent Domain Software

Other Threads