共用方式為


CMFCBaseTabCtrl::SetImageList

Sets the icon image list for the tab control.

virtual BOOL SetImageList(
   UINT uiID,
   int cx = 15,
   COLORREF clrTransp = RGB(255,0,255)
);

virtual BOOL SetImageList(
   HIMAGELIST hImageList 
);

Parameters

  • [in] uiID
    A bitmap resource ID. SetImageList loads the image list from this resource.

  • [in] cx
    The width of each image in pixels.

  • [in] clrTransp
    A COLORREF parameter that indicates the transparent color of the image.

  • [in] hImageList
    A handle to a preloaded image list.

Return Value

Nonzero if the method was successful; 0 otherwise.

Remarks

The images from the icon image list are displayed alongside the labels for the tab. To display an icon, you must specify its index when you call CMFCBaseTabCtrl::AddTab.

SetImageList will fail if the tab control was created with a flat style. It will also fail if the framework cannot load the image indicated by uiID.

This method recalculates the height of the tab according to the image and text sizes.

Requirements

Header: afxbasetabctrl.h

See Also

Reference

CMFCBaseTabCtrl Class

Hierarchy Chart