0
votes

We have MFC Application and it has Toolbar, Toolbar use bmp 32 colors resource file in Visual Studio 2010. This application runs fine in VS2010.

VS2010 Bitmap file property

After converting this application in Visual Studio 2015, toolbar icon does not visible. Visual Studio 2015 shows Format properties 32bpp BGR

VS2015 Bitmap file property

Is anything change in VS2015 bitmap editor or Am I missing some properties settings here ?

1
Is seems to me the conversion has surely done shit! I think you should open it with an old version of GIMP. I remember having this kind of problems! VC++ applications only support a very specific format of transparent bitmaps! Tomorrow I may give you more detailed guidance!sergiol
Do you still have the unconverted ones? Can you try to overwrite the new ones with them?sergiol
Still having same problem.Mehul Donga
Try to open image on GIMP 2.6.0 (Newer versions failed for me!) and export as BMP. On the meanwhileblog.files.wordpress.com/2016/03/gimp-ex.png dialog choose the option X8R8G8B8.sergiol
I did all steps that you mention but still facing the same problem.Mehul Donga

1 Answers

0
votes

We are able to resolve this problem after creating low resource version of toolbar that MFC will accept. We have Created low resource id that should be refer to toolbar resource that has the identical layout as your original toolbar with respect to the command ids but reference to low resolution bmp file that MFC will accept.

Change following code in MainFrame::OnCreate

if (!m_wndToolBar.Create(this, WS_CHILD | WS_VISIBLE | CBRS_FLOATING, IDR_LOWRES_RES_ID) || !m_wndToolBar.LoadToolBar(IDR_LOWRES_RES_ID))
{
    TRACE0("Failed to create add fields bar\n");
    return -1;      // fail to create
}
//Added

//Replace imagelist with 32 bit bmp

CToolBarCtrl& ctl = m_wndToolBar.GetToolBarCtrl();

CImageList *pList = ctl.GetImageList();

// Delete low res image list
pList->DeleteImageList();

pList->Create(34, 34, ILC_COLOR32, 32, 0);

ctl.SetImageList(pList);

ctl.AddBitmap(32, IDR_ADD_HIGH_RES_ID);