次の方法で共有


Using Image Lists in an Extended Combo Box Control

OverviewSample

The main feature of extended combo box controls is the ability to associate images from an image list with individual items in a combo box control. Each item is able to display three different images: one for its selected state, one for its nonselected state, and a third for an overlay image.

The following procedure associates an image list with an extended combo box control:

To associate an image list with an extended combo box control

  1. Construct a new image list (or use an existing image list object), using the constructor and storing the resultant pointer.

  2. Initialize the new image list object by calling . The following code is one example of this call.

    m_pImageList->Create(16, 16, ILC_COLOR, 2, 2);
    
  3. Add optional images for each possible state: selected or nonselected, and an overlay. The following code adds three predefined images.

    m_pImageList->Add(pApp->m_hIconSelected);
    m_pImageList->Add(pApp->m_hIconNotSelected);
    m_pImageList->Add(pApp->m_hIconOverlay);
    
  4. Associate the image list with the control with a call to .

Once the image list has been associated with the control, you can individually specify the images each item will use for the three possible states. For more information, see Setting the Images for an Individual Item.

See Also   Windows Common Controls and MFC Classes