Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

List Box color

Posted on 2004-04-14
2
Medium Priority
?
281 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
[X]
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
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 400 total points
ID: 10822259
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

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 …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

618 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