Search code examples
visual-studiobitmapmfcvisual-studio-2019gimp

Modify Toolbar for MFC MS Visual Studio 2019 app with Gimp


I'm trying to modify a toolbar's BMP file with GIMP 2.10.24 (tried with 2.9, too) for a MFC application in Visual Studio 2019's resource editor.

Using these explanations, I can save the BMP file so that it opens in Visual Studio. I also set the mode to RGB and made sure there is no alpha channel.

The title of the MS VS editor reads

0x0, 1 bit, BMP

just like before.

The app builds OK, but when I run it,

VERIFY(toolBar->LoadToolBar(nID));

fails with an exception.

Is there anything else I need to do to make my toolbar load again?

Thanks in advance!


Solution

  • I finally worked out a solution that works with recent versions of GIMP (thanks to everyone who contributed!):

    • Do NOT convert to RGB! The confusion comes from the fact that ‘Advanced options’ is only active if you convert to RGB, but you do not need the advanced options. Maybe that changed at one point in MSVS or in GIMP, because explanations on different forums are confusing about this point...
    • Image/Mode -> Indexed colors (DO NOT CHANGE THIS)

    File/Export as ... :

    • Run-Length encoded : do not check
    • Compatibility options : do not write color space information : check
    • Advanced options : is not accessible, but that DOESN'T MATTER ! Additional trick: you can copy-paste the buttons of toolbars (not the entire toolbar) one by one from Gimp to VS (if the color settings in Gimp are as explained above ; if not, you loose / mix up the colors).

    Tested with Microsoft Visual Studio 2019 enterprise edition and GIMP 2.10.