Link to home
Start Free TrialLog in
Avatar of jonassondaniel
jonassondaniel

asked on

Color in ListView

How do I set the color of one or more rows (not all!) in a ListView?
Avatar of Slavak
Slavak

Set OwnerDraw to True and write OnCustomDraw event code.

slavak.
smartie.
tell jonassondaniel where he can find property OwnerDraw in TListView...

BlackDeath.
Hi, Black.

TListView OwnerDraw property exist in D4. If you use previsious version of Delphi you can see the source for D4 TListView. If need I can do it for you.

Regards,
  Slava.
 

Avatar of jonassondaniel

ASKER

Hmm.. I know what you're talking about.. but I don't think I'll manage to do it on my own... If you could provide some code for changing the color of a certain row in a ListView control I'd be really happy.. I have increased the points for your trouble (if you decide to help...).

(What I'm trying to do is a simple filemanager and I want to associate a certain color to files with same extension.)
ASKER CERTIFIED SOLUTION
Avatar of Slavak
Slavak

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I tried what you are suggsting but it doesn't seem to work. Do I need to do something more than what you're describing perhaps?
I don't know what to say.
I just now made new application, droped TListView on form and ovveride the OnCustomDrawItem event with code above.
And this is working.

I have english Delphi 4 Client/Server with update 3.

Do you have another version of Delphi?


I tried again (with a new app) and now it works. Strange.. I did exactly the same way as last time.. ..but well it works and I'm happy!  Thanks!