Solved

List Box color

Posted on 2004-04-14
2
249 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
repeateFront java challenge 31 87
Folder Comparison 12 52
Detect CR LF to each line 12 137
sum28 challenge 31 96
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
This video discusses moving either the default database or any database to a new volume.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now