Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

How to change the color of text in a listbox

Posted on 1998-08-24
Last Modified: 2010-04-10
How can i change the color of individual lines of text in a listbox
i'm using visual c++ 5
Thanx in aDvance
Question by:mwebster
  • 4
  • 2
LVL 23

Accepted Solution

chensu earned 50 total points
ID: 1171146
If you want all the text to be the same color, catch the WM_CTLCOLORLISTBOX message (or override CWnd::OnCtlColor for MFC). If you want each line to have different color, create an  owner-draw list box (override CListBox::OnDrawItem, ...).

Author Comment

ID: 1171147
do you have any sample code for an owner drawn listbox
thanx again
LVL 23

Expert Comment

ID: 1171148
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

LVL 23

Expert Comment

ID: 1171149

Author Comment

ID: 1171150
thanx again but the second url does not exist and do you have anything in using visual c++.
LVL 23

Expert Comment

ID: 1171151
The second URL is correct. Try this

Or go to http://www.codeguru.com, click "other controls" on the left navigation bar, there are some list box related articles.

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question