Board index » delphi » Set color of line item in ListBox, MemoBox or RichEdit

Set color of line item in ListBox, MemoBox or RichEdit

I am trying to set the color of each line of text in the ListBox control.
The only property that I know of is the Font.Color,  but the color setting
will affect the entire list rather rather than each line of the list.

I would need some helps on how to set the color of individual line in
the listbox control.  Am I was using the wrong control?  

Pls help me!!!!!

 

Re:Set color of line item in ListBox, MemoBox or RichEdit


Sheak:

You have to set the Style property of the TListBox to either
lbOwnerDrawFixed or lbOwnerDrawVariable and handle the drawing of the text
your self in a handler for the OnDrawItem event.

--
Regards
Ralph (TeamB)

Quote
Sheak wrote in message <01bd2626$d59eaa80$0c00a...@sheakpc.dbix.com.my>...
>I am trying to set the color of each line of text in the ListBox control.
>The only property that I know of is the Font.Color,  but the color setting
>will affect the entire list rather rather than each line of the list.

>I would need some helps on how to set the color of individual line in
>the listbox control.  Am I was using the wrong control?

>Pls help me!!!!!

Re:Set color of line item in ListBox, MemoBox or RichEdit


Quote
>I would need some helps on how to set the color of individual line in
>the listbox control.  Am I was using the wrong control?

With ListBox you'll have to play with owner-draw feature of it.
If you want to do this with Memo control, you could try our ColorMemo
component. It does color-coding like a snap. And it's FREE.
Surf to http://users.voras.lt/~gintaras/bs
_________________________________________
Gintaras Pikelis - Baltic Solutions
e-mail : Ginta...@Voras.lt
http://users.voras.lt/~gintaras/bs

Other Threads