Solved

List Box color

Posted on 2004-04-14
2
254 Views
Last Modified: 2013-11-20
Hi!

Check next code:

  CListBox   *pCLB;
  char       szB [256];

  pCLB = (CListBox *) GetDlgItem (IDC_TESTPLACE_LIST);  // get List-Box
  sprintf (szB, "%s", MessageText);
  if (szB[0] != 0) {
    pCLB->InsertString(-1, &szB[0]);
  }

Text is now displayed only in black color. How can I set different text colors in CListBox?

Thanks
Sasa
0
Comment
Question by:sasabunetic
2 Comments
 
LVL 4

Expert Comment

by:caner_elci
ID: 10822153
You have to use owner draw items.. Set ListBox's OWNERDRAW style and use CListBox::MeasureItem, CListBox::DrawItem pair to draw your own items.. So you can set any color or font in your list box..
A featured sample can be found at : http://www.codeproject.com/combobox/xlistbox.asp
0
 
LVL 14

Accepted Solution

by:
Daniel Junges earned 100 total points
ID: 10822259
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 101
centeredAverage challenge 8 167
withoutTen challenge 14 123
building a service to accessed via telnet client, want colors ? 4 89
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

831 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