Click here to Skip to main content
11,428,004 members (60,662 online)
Click here to Skip to main content

ComboBox bold - Combo box with bold text items and optional icon.

, 5 Aug 2003
Rate this:
Please Sign up or sign in to vote.
Combo Box that allows you to set some of the items to be bold

Introduction

This is simple extension to the basic MFC combo box.

Usage

  1. Create a combo box in your dialog, make it "owner draw fixed" and "has strings".
  2. Then just add a member to the dialog for that combo, of type CComboBoxBold.
  3. Then use the functions of the CComboBoxBold as follows:
    CComboBoxBold::SetIcon(int itemId,int iconId);
    CComboBoxBols::SetItemBold(int itemId, BOOL bold);

Example:

BOOL CBoldComboDemoDlg::OnInitDialog()
{
    CDialog::OnInitDialog();
    // Set the icon for this dialog. The framework does this automatically
    // when the application's main window is not a dialog
    SetIcon(m_hIcon, TRUE); // Set big icon
    SetIcon(m_hIcon, FALSE); // Set small icon
    // TODO: Add extra initialization here
    m_combo.SetItemBold(2,TRUE);
    m_combo.SetItemBold(4,TRUE);
    m_combo.SetIcon(0,IDI_ICON2);
    m_combo.SetIcon(1,IDI_ICON3);
    m_combo.SetIcon(2,IDI_ICON4);
    m_combo.SetIcon(3,IDI_ICON6);
    m_combo.SetIcon(5,IDI_ICON2);
    m_combo.SetIcon(6,IDI_ICON4);
    return TRUE; // return TRUE unless you set the focus to a control
}

History

Aug 6, 2003 - Updated source and demo project.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Alex Hazanov
Software Developer (Senior) RDV Systems
Israel Israel
No Biography provided

Comments and Discussions

 
GeneralFix icon not destroyed Pin
gpidat16-Nov-10 21:53
membergpidat16-Nov-10 21:53 
GeneralCComboBox properties that need to set! Pin
TigerTom10-Aug-10 0:24
memberTigerTom10-Aug-10 0:24 
GeneralRe: CComboBox properties that need to set! Pin
TigerTom10-Aug-10 0:45
memberTigerTom10-Aug-10 0:45 
Answerdelete items on the fly Pin
xinkmt4-Aug-10 21:59
memberxinkmt4-Aug-10 21:59 
Answersee http://www.codeproject.com/KB/combobox/checkcombo.aspx Pin
xinkmt4-Aug-10 22:01
memberxinkmt4-Aug-10 22:01 
Generalthanks Pin
nobihai19-Oct-08 6:43
membernobihai19-Oct-08 6:43 
GeneralBug fixes Pin
Alex Hazanov17-Sep-03 3:15
memberAlex Hazanov17-Sep-03 3:15 
Generaldroplist property showing error Pin
subbakiran17-Sep-03 1:16
susssubbakiran17-Sep-03 1:16 
GeneralRe: droplist property showing error Pin
Alex Hazanov17-Sep-03 3:03
memberAlex Hazanov17-Sep-03 3:03 
GeneralRe: droplist property showing error Pin
teli520013-Jun-05 18:46
memberteli520013-Jun-05 18:46 
GeneralRe: droplist property showing error Pin
Heather L14-Jan-04 9:12
memberHeather L14-Jan-04 9:12 
GeneralDebug Assertion Failed Pin
subbakiran16-Sep-03 22:01
susssubbakiran16-Sep-03 22:01 
GeneralRe: Debug Assertion Failed Pin
subbakiran16-Sep-03 22:07
susssubbakiran16-Sep-03 22:07 
GeneralRe: Debug Assertion Failed Pin
Karpaga Rajan28-Oct-05 7:09
memberKarpaga Rajan28-Oct-05 7:09 
GeneralRe: Debug Assertion Failed Pin
auliac24-Dec-09 16:39
memberauliac24-Dec-09 16:39 
GeneralmyMap not updated on item removal Pin
natenez13-Sep-03 20:44
membernatenez13-Sep-03 20:44 
GeneralRe: myMap not updated on item removal Pin
Alex Hazanov17-Sep-03 3:13
memberAlex Hazanov17-Sep-03 3:13 
GeneralRe: myMap not updated on item removal Pin
natenez17-Sep-03 7:49
membernatenez17-Sep-03 7:49 
GeneralIt doesn't provide CBS_OWNERDRAWFIXED in CE Pin
Edward Kuo21-Aug-03 16:27
sussEdward Kuo21-Aug-03 16:27 
GeneralRe: It doesn't provide CBS_OWNERDRAWFIXED in CE Pin
Alex Hazanov23-Aug-03 21:21
memberAlex Hazanov23-Aug-03 21:21 
GeneralRe: It doesn't provide CBS_OWNERDRAWFIXED in CE Pin
natenez29-Sep-03 13:43
membernatenez29-Sep-03 13:43 
GeneralRe: It doesn't provide CBS_OWNERDRAWFIXED in CE [modified] Pin
mahendra.pardeshi@yahoo.com18-Apr-07 23:56
membermahendra.pardeshi@yahoo.com18-Apr-07 23:56 
GeneralMultiple Icons Pin
Alex Hazanov6-Aug-03 21:01
memberAlex Hazanov6-Aug-03 21:01 
GeneralRe: Multiple Icons Pin
Ravi Bhavnani7-Aug-03 5:18
memberRavi Bhavnani7-Aug-03 5:18 
GeneralRe: Multiple Icons Pin
Alex Hazanov9-Aug-03 21:27
memberAlex Hazanov9-Aug-03 21:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150428.2 | Last Updated 6 Aug 2003
Article Copyright 2003 by Alex Hazanov
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid