Click here to Skip to main content
13,353,322 members (60,476 online)
Click here to Skip to main content
Add your own
alternative version


47 bookmarked
Posted 19 Aug 2001

Dynamically Highlight Elements in a List Control

, 20 Aug 2001
Rate this:
Please Sign up or sign in to vote.
Use the custom draw features of a List Control to dynamically find and hightlight items.

Just type a name it gets highlighted!


It seems more and more like my projects revolve around the List Control in some form or another. I also seem to be using CodeProject more and more to find out how to do things in my code.

One day, I came across Michael Dunn's excellent article Neat Stuff to do in List Controls Using Custom Draw and it got me to thinking about how to do some really functional stuff with a list control.

I had recently done a project where certain attributes were displayed in a list control. And, at the time, I thought it would be neat if I could color text in a column based on certain criteria, specifically, the text in the cell. Well, due to time constraints, that feature never made it into the project.

But, since then, I've had time to revisit, and have come up with that functionality in this little application.

Simply type in a name in the edit box, and if the name is found in the List Control, it's highlighted yellow and it's text is changed to red.

The specifics of Custom Draw in a List Control are presented in Michael's article, and I've tried to document the code nicely.



This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Coleman Brumley
United States United States
No Biography provided

You may also be interested in...


Comments and Discussions

QuestionHow can make the subitem of the listcontrol to be highlighted when the user clicks on a particular subitem Pin
sivavuyyuru16-Jun-14 1:02
membersivavuyyuru16-Jun-14 1:02 
QuestionPartially Changing background color Pin
Member 783682910-Feb-14 20:54
memberMember 783682910-Feb-14 20:54 
Questionnice code Pin
sally899812-Dec-11 16:48
membersally899812-Dec-11 16:48 
GeneralThanks! Pin
lucy15-Feb-11 10:38
memberlucy15-Feb-11 10:38 
GeneralGreat article! Pin
monimicki21-Oct-04 18:14
membermonimicki21-Oct-04 18:14 
GeneralGreat But Pin
Juha Kiviranta26-Jun-03 22:36
sussJuha Kiviranta26-Jun-03 22:36 
GeneralRe: Great But Pin
C_BRUMLEY15-Mar-06 18:12
memberC_BRUMLEY15-Mar-06 18:12 
Generalfiltering Pin
bcengiz9-Oct-02 4:49
memberbcengiz9-Oct-02 4:49 
GeneralVery usefull Pin
Anonymous30-Jul-02 6:15
sussAnonymous30-Jul-02 6:15 
GeneralRe: Download Pin
Brian V Shifrin20-Aug-01 13:08
memberBrian V Shifrin20-Aug-01 13:08 
GeneralRe: Download Pin
Coleman Brumley20-Aug-01 18:38
memberColeman Brumley20-Aug-01 18:38 
GeneralRe: Download Pin
Coleman Brumley20-Aug-01 19:13
memberColeman Brumley20-Aug-01 19:13 
GeneralDownload Pin
FilthyZombie20-Aug-01 4:33
memberFilthyZombie20-Aug-01 4:33 
GeneralRe: Download Pin
Anonymous24-Jul-05 22:51
sussAnonymous24-Jul-05 22:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.180111.1 | Last Updated 21 Aug 2001
Article Copyright 2001 by Coleman Brumley
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid