4 Replies Latest reply on Feb 3, 2017 3:21 PM by Adam Hoffman

    Bitmap Image List

    Joe Pickens

      How do I create a Bitmap Image List. I am trying to add my own icons to my Solidworks Addin and I followed the instructions i found on http://www.basis.com/kb00785 to create Bitmap Image Lists but when I add them to the addin there are not recognized. I have been searching online for a while and i cant seem to find anything on the topic. So is there any way to take a list of separate bmp files and create a  Bitmap Image List.


      The files I have made are of the appropriate size and work as individual bitmap files its just the list I'm having issues with


      In the addin code this is the code im working with to call the bitmap files


                  cmdGroup.LargeIconList = iBmp.CreateFileFromResourceBitmap("SwCSharpAddin3.ToolbarLarge.bmp", thisAssembly);

                  cmdGroup.SmallIconList = iBmp.CreateFileFromResourceBitmap("SwCSharpAddin3.ToolbarSmall.bmp", thisAssembly);

                  cmdGroup.LargeMainIcon = iBmp.CreateFileFromResourceBitmap("SwCSharpAddin3.MainIconSmall.bmp", thisAssembly);

                  cmdGroup.SmallMainIcon = iBmp.CreateFileFromResourceBitmap("SwCSharpAddin3.MainIconLarge.bmp", thisAssembly);

        • Re: Bitmap Image List
          Amen Allah Jlili

          There are many reasons why that may not be working.



          Are you sure that's the path "SwCSharpAddin3.ToolbarSmall.bmp" is right one? I think the path should contain properties and resources in it but I'm not sure. Take a look at this example I did.  The problem with iBmp.CreateFileFromResourceBitmap is that returns an empty string incase of an exception.


          To be certain you're not creating the images bmp incorrectly, instead of using the dll embedded resources, use the direct path to the icons.

          The image bitmap for the small icon list should be H:16 W:16*n where n is the number of icons. For the large icons, it's 24 pixels. Use Gray (RGB=192,192,192) for transparent.


          If you're using creating buttons inside tabs, make sure the hint and description are not empty strings.


          This has given me an idea to write a small guide about this.