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

x
?
Solved

Change font in a CListBox!

Posted on 1999-01-26
3
Medium Priority
?
616 Views
Last Modified: 2013-12-03
I have a ListBox ,with a control called m_CdList, on a PropertySheet and I would like to change the font face and size in that ListBox. I would like the code since I have tried different ways without success.
Thanx
0
Comment
Question by:Slask
[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
3 Comments
 
LVL 12

Expert Comment

by:migel
ID: 1328330
Do you try m_CdList.SetFont()?
0
 
LVL 1

Accepted Solution

by:
jim_pettinato earned 240 total points
ID: 1328331
void CDialogWithListBox::OnInitDialog()
{
   CDialog::OnInitDialog;
   // create a font for the CList
   LOGFONT lf;
   ZeroMemory(&lf, sizeof(lf));
   lf.lfHeight = 10;    // use desired size
   lstrcpy(lf.lfFaceName, "MS Sans Serif"); // use desired name
   m_hFont = CreateFontIndirect(&lf);
   // access the control, send the WM_SETFONT message
   CListBox *list = (CListBox *)GetDlgItem(ID_LIST_BOX);
   ASSERT(list);
   list.SendMessage(WM_SETFONT, (WPARAM)m_hFont, TRUE);


Note: there are cleaner ways of doing this now but this works for the widest variety of MFC platforms/revisions.
0
 

Author Comment

by:Slask
ID: 1328332
Thank you
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Suggested Courses

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