Click here to Skip to main content
Licence CPOL
First Posted 19 Aug 2001
Views 128,536
Downloads 1,017
Bookmarked 38 times

Dynamically Highlight Elements in a List Control

By | 20 Aug 2001 | Article
Use the custom draw features of a List Control to dynamically find and hightlight items.

Just type a name it gets highlighted!

Introduction

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.

Enjoy!

License

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

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Questionnice code Pinmembersally899815:48 12 Dec '11  
GeneralThanks! Pinmemberlucy9:38 15 Feb '11  
GeneralGreat article! Pinmembermonimicki17:14 21 Oct '04  
GeneralGreat But PinsussJuha Kiviranta21:36 26 Jun '03  
GeneralRe: Great But PinmemberC_BRUMLEY17:12 15 Mar '06  
Generalfiltering Pinmemberbcengiz3:49 9 Oct '02  
GeneralVery usefull PinsussAnonymous5:15 30 Jul '02  
GeneralRe: Download PinmemberBrian V Shifrin12:08 20 Aug '01  
GeneralRe: Download PinmemberColeman Brumley17:38 20 Aug '01  
GeneralRe: Download PinmemberColeman Brumley18:13 20 Aug '01  
GeneralDownload PinmemberFilthyZombie3:33 20 Aug '01  
GeneralRe: Download PinsussAnonymous21:51 24 Jul '05  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web04 | 2.5.120517.1 | Last Updated 21 Aug 2001
Article Copyright 2001 by Coleman Brumley
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid