Color List Box With Extra Bits
Posted
by E Buzoku
on October 30th, 2001
Environment:
Developed using VC6, tested on Win2k Pro and XP Pro.
This MFC CListBox class extension is result of searching for a listbox that does exactly what I have implemented here, except for the vertical alignment. After browsing through CodeGuru site, I found some code but none that fully matched my project needs. Still, all the credit to Patrice Godard and Paul M. Meidinger for designing CColorListBox class, found at http://www.codeguru.com/listbox/colorlb.shtml, that I got the idea from.
CListBoxEBX Features
- Background color.
- Foreground color.
- Text horizontal alignment.
- Text vertical alignment.
- Indicating inactive items.
- Hooking of a DWORD value per item as in original SetItemData().
- Allows for setting of the items height
Future desired features
- Font manipulation.
- Use of images
- Horizontal scrolling.
// Instantiate the wrapper for the list box window CListBoxEBX m_xList; // This can be inserted in the ::OnInitDialog() m_xList.SetItemHeight(40); m_xList.AddItem("First string"); m_xList.AddItem("Last string"); m_xList.InsertItem("Middle string #1", 1, RGB(50, 100, 150), RGB(255, 255,255)); m_xList.InsertItem("Middle string #2", 1, RGB(100, 150, 200), RGB(255, 255,255)); m_xList.InsertItem("Middle string #3", 1, 12432321, RGB(255, 255,255)); m_xList.SetActive(FALSE, 2); m_xList.SetCurSel(0);
Downloads
Download demo project - 20 KbDownload source - 5 Kb

Comments
Multiple Selection?
Posted by Saturion on 04/05/2006 05:36amDownload link broken?
Posted by spudlips on 12/16/2005 03:21pmDemo project and source links fail.
-
ReplyNo Problem !
Posted by Promotional Engine on 08/22/2006 10:20pmI can download both with no problem.
ReplySorting?
Posted by alforno on 09/28/2004 04:48pmIt seems like the sorting is not working when I use this class. Anyone know how to turn it back on or why it isn't working?
Replysettabstops
Posted by Legacy on 10/20/2003 12:00amOriginally posted by: Johan
How can I use with settabstops() ? it doesnt seem to work for me.
/Johan
ReplyDisabled Item?
Posted by Legacy on 06/24/2003 12:00amOriginally posted by: David
Can anyone explain what the difference is between active and inactive items?
ReplyDisabled Control?
Posted by Legacy on 12/04/2002 12:00amOriginally posted by: Tommy Evans
If I disable the control, the background still shows normal (as if it was enabled). How do you change it so it appears disabled?
Thanks - this is an awesome control!
Replyhow to change to backgroud image?
Posted by Legacy on 07/16/2002 12:00amOriginally posted by: linda
can u change ur back image ,not color !Thanks a lot!
Reply
How to change to italics
Posted by Legacy on 11/01/2001 12:00amOriginally posted by: Benilu
Do you know how to switch the font so that it draws on italics?
To email, eliminate underscore
Reply