共用方式為


CMFCTabCtrl::SetImageList

Specifies an image list.

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

Parameters

  • [in] uiID
    The ID of a bitmap resource that contains the image list.

  • [in] cx
    The width of each image, in pixels. The default value is 15.

  • [in] clrTransp
    The transparent image color. The parts of the image that are this color will be transparent. The default value is the color magenta, RGB(255,0,255).

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

Return Value

TRUE if this method is successful. FALSE if the tab control is created by using a flat style or if the first method overload cannot load the bitmap that is specified by the uiID parameter.

Remarks

Use this method to set an image list for the tab control. The images from the image list are displayed next to the tab label. This method recalculates the tab height so that the tab is sized to contain both the image and the text.

Use the CMFCBaseTabCtrl::AddTab method that is inherited by the tab control to specify the index of the image to display.

Requirements

Header: afxtabctrl.h

See Also

Reference

CMFCTabCtrl Class

Hierarchy Chart

CMFCBaseTabCtrl::AddTab