Click here to Skip to main content
Licence 
First Posted 16 Jul 2003
Views 125,808
Bookmarked 45 times

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

By | 5 Aug 2003 | Article
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

About the Author

Alex Hazanov

Software Developer (Senior)
RDV Systems
Israel Israel

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralFix icon not destroyed Pinmembergpidat20:53 16 Nov '10  
GeneralCComboBox properties that need to set! PinmemberTigerTom23:24 9 Aug '10  
GeneralRe: CComboBox properties that need to set! PinmemberTigerTom23:45 9 Aug '10  
Answerdelete items on the fly Pinmemberxinkmt20:59 4 Aug '10  
Answersee http://www.codeproject.com/KB/combobox/checkcombo.aspx Pinmemberxinkmt21:01 4 Aug '10  
Generalthanks Pinmembernobihai5:43 19 Oct '08  
GeneralBug fixes PinmemberAlex Hazanov2:15 17 Sep '03  
Generaldroplist property showing error Pinsusssubbakiran0:16 17 Sep '03  
GeneralRe: droplist property showing error PinmemberAlex Hazanov2:03 17 Sep '03  
GeneralRe: droplist property showing error Pinmemberteli520017:46 13 Jun '05  
GeneralRe: droplist property showing error PinmemberHeather L8:12 14 Jan '04  
GeneralDebug Assertion Failed Pinsusssubbakiran21:01 16 Sep '03  
GeneralRe: Debug Assertion Failed Pinsusssubbakiran21:07 16 Sep '03  
GeneralRe: Debug Assertion Failed PinmemberKarpaga Rajan6:09 28 Oct '05  
GeneralRe: Debug Assertion Failed Pinmemberauliac15:39 24 Dec '09  
GeneralmyMap not updated on item removal Pinmembernatenez19:44 13 Sep '03  
GeneralRe: myMap not updated on item removal PinmemberAlex Hazanov2:13 17 Sep '03  
GeneralRe: myMap not updated on item removal Pinmembernatenez6:49 17 Sep '03  
GeneralIt doesn't provide CBS_OWNERDRAWFIXED in CE PinsussEdward Kuo15:27 21 Aug '03  
GeneralRe: It doesn't provide CBS_OWNERDRAWFIXED in CE PinmemberAlex Hazanov20:21 23 Aug '03  
GeneralRe: It doesn't provide CBS_OWNERDRAWFIXED in CE Pinmembernatenez12:43 29 Sep '03  
GeneralRe: It doesn't provide CBS_OWNERDRAWFIXED in CE [modified] Pinmembermahendra.pardeshi@yahoo.com22:56 18 Apr '07  
GeneralMultiple Icons PinmemberAlex Hazanov20:01 6 Aug '03  
GeneralRe: Multiple Icons PinmemberRavi Bhavnani4:18 7 Aug '03  
GeneralRe: Multiple Icons PinmemberAlex Hazanov20:27 9 Aug '03  

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.

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