Image List Box

The CImageListBox class is derived from CListBox. I get inspiration from the CCheckListBox MFC class.

The Image List Box shows a list of images. It is not possible to display text.

To use the class just include the source and header file into your project. Add a List Box control to your dialog box resource. The List Box added must have the following properties: Owner draw = fixed; No integral height = False

With ClassWizard add a control member variable for the List Box. As variable type choose CImageListBox.

Then, in the OnInitDialog function of your dialog box create an ImageList and connect it to the ImageListBox, using SetImageList function. Insert elements into the ImageListBox using AddItem function.



BOOL CTestDlg::OnInitDialog()
{
    CDialog::OnInitDialog();

    m_ImageList.Create(IDB_SEZIONIRICORRENTI, 40, 0, RGB(255, 255, 255));
    m_lstTest.SetImageList(&m_ImageList);

    for (int i=0; i<10; i++)
        m_lstTest.AddItem(i);

    return TRUE;
}


Download demo project - 72 KB

Download source - 4 KB



Comments

  • [Q] How can I delete all items or pointed item?

    Posted by Legacy on 05/22/2000 12:00am

    Originally posted by: hosang

    Hi...
    How can I delete all items or pointed item?
    I want to deleteing all items and inserting new items.

    Have a nice day!

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • With 81% of employees using their phones at work, companies have stopped asking: "Is corporate data leaking from personal devices?" and started asking: "How do we effectively prevent corporate data from leaking from personal devices?" The answer has not been simple. ZixOne raises the bar on BYOD security by not allowing email data to reside on the device. In addition, Zix allows employees to maintain complete control of their personal device, therefore satisfying privacy demands of valued employees and the …

  • Corporate e-Learning technology has a long and diverse pedigree. As far back as the 1980s, companies were adopting computer-based training to supplement traditional classroom activities. More recently, rich web-based applications have added streaming audio and video, real-time collaboration and other new tools to the e-Learning mix. At the same time, the growing availability of informal learning tools--a category that includes everything from web searches to social media posts--are having a major impact on …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds