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

  • 10 Rules that Make or Break Enterprise App Development Projects In today's app-driven world, application development is a top priority. Even so, 68% of enterprise application delivery projects fail. Designing and building applications that pay for themselves and adapt to future needs is incredibly difficult. Executing one successful project is lucky, but making it a repeatable process and strategic advantage? That's where the money is. With help from our most experienced project leads and software engineers, …

  • Live Event Date: August 19, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT You deployed your app with the Bluemix PaaS and it's gaining some serious traction, so it's time to make some tweaks. Did you design your application in a way that it can scale in the cloud? Were you even thinking about the cloud when you built the app? If not, chances are your app is going to break. Check out this upcoming webcast to learn various techniques for designing applications that will scale successfully in Bluemix, for the …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds