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

  • IBM Worklight is a mobile application development platform that lets you extend your business to mobile devices. It is designed to provide an open, comprehensive platform to build, run and manage HTML5, hybrid and native mobile apps.

  • Agile methodologies give development and test teams the ability to build software at a faster rate than ever before. Combining DevOps with hybrid cloud architectures give teams not just the principles, but also the technology necessary to achieve their goals. By combining hybrid cloud and DevOps: IT departments maintain control, visibility, and security Dev/test teams remain agile and collaborative Organizational barriers are broken down Innovation and automation can thrive Download this white paper to …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds