step1: create a bitmap resource with the images
you can also use icons or even create the images at run time.
the size of the images should be in proportion to the height
of the label.
step2: add member variable of type Cimagelist
protected:
CImagelist m_imagetab;
step3: Override OnInitDialog() and add code to it
bool CmyPropSheet::OnInitDialog()
{
bool bresult=CProperttySheet::OnInitDialog();
m_imagetab.create(IDB_TABIMAGES,13,1,RGB(255,255,255));
CTabCtrl *pTab=GetTabControl();
pTab->SetImageList(&m_imagetab);
tc_item tcitem;
tcitem.mask=tcif_image;
for(int i=0;i<3;i )
{
tcitem.iimage=i;
pTab->SetItem(i,&tcitem);
}
return bresult;
}
C Builder 没有提供 SetImageList,SetItem这样的函数,但我们能够直接处理WINDOWS API 消息:TCM_SETIMAGELIST,TCM_SETITEM. 看下面的代码能够体会不同的编程风格。
void __fastcall TForm1::FormPaint(TObject *Sender)
{
TabControl1->Perform ( TCM_SETIMAGELIST, 0, ImageList1->Handle );
TCITEM tcitem;
tcitem.mask=TCIF_IMAGE ;
for(int i=0;i<3;i )
{
tcitem.iImage=i;
TabControl1->Perform ( TCM_SETITEM, i,(LPARAM) (LPTCITEM) &tcitem );
}
}




