I am using an outlookbar style property sheet with 3 property pages as the main window of my application.I am unable to change the bitmap icons displayed on the property sheet.I have given code here which isn't working. Please suggest any strategy to change the bitmap icons.You can ignore the code any other approach is welcome.
The following is the way the property sheet is initialized:
CBitmap bmpimgs[3];
int retval;
bmpimgs[0].LoadBitmapA(IDB_BITMAP77);
bmpimgs[1].LoadBitmapA(IDB_BITMAP81);
bmpimgs[2].LoadBitmapA(IDB_BITMAP79);
retval = m_PropSht.m_shtSelImages.Create(80, 80, ILC_COLOR24 | ILC_MASK, 1, 1);
retval = m_PropSht.m_shtSelImages.Add(&bmpimgs[0], RGB(128, 128, 128));
retval = m_PropSht.m_shtSelImages.Add(&bmpimgs[1], RGB(128, 128, 128));
retval = m_PropSht.m_shtSelImages.Add(&bmpimgs[2], RGB(128, 128, 128));
m_PropSht.SetIconsList(m_PropSht.m_shtSelImages.m_hImageList);
m_PropSht.SetLook(CMFCPropertySheet::PropSheetLook_OutlookBar, 80);
What I have tried:
I have created a function called ChangeImageList to change the image list associated with the property sheet. I get a failed assertion error when I try to call
SetIconsList function with the changed image list.
void AppPropSheet::ChangeImgList(int sel)
{
static bool firsttime = true;
CBitmap bmpimgs[3],bmpmask;
int retval;
if (sel == 0)
bmpimgs[0].LoadBitmapA(IDB_BITMAP87);
else
bmpimgs[0].LoadBitmapA(IDB_BITMAP77);
if (sel == 1)
bmpimgs[1].LoadBitmapA(IDB_BITMAP86);
else
bmpimgs[1].LoadBitmapA(IDB_BITMAP81);
if (sel == 2)
bmpimgs[2].LoadBitmapA(IDB_BITMAP88);
else
bmpimgs[2].LoadBitmapA(IDB_BITMAP79);
m_shtSelImages.Remove(2);
m_shtSelImages.Remove(1);
m_shtSelImages.Remove(0);
ImageList_Destroy(m_shtSelImages.m_hImageList);
retval = m_shtSelImages.Create(81, 81, ILC_COLOR24 | ILC_MASK, 1, 1);
retval=m_shtSelImages.Add(&bmpimgs[0],RGB(128,128,128));
retval=m_shtSelImages.Add(&bmpimgs[1], RGB(128, 128, 128));
retval=m_shtSelImages.Add(&bmpimgs[2], RGB(255, 255, 255));
SetIconsList(m_shtSelImages.m_hImageList);
GetTabControl()->Invalidate();
RedrawWindow();
}