Bitmap array in a single file

Asked

Viewed 106 times

3

I am making an application for Solidwoks and downloaded some examples, in it are used some BMP images as the following view:

Bitmap com várias imagens

These images are used as images in menus as follows in C code#:

BitmapHandler iBmp = new BitmapHandler();
cmdGroup = iCmdMgr.CreateCommandGroup2(mainCmdGroupID, TitleDr, ToolTipDr, "", -1, ignorePrevious, ref cmdGroupErr);
cmdGroup.LargeIconList = iBmp.CreateFileFromResourceBitmap("EngToolsSW.ToolbarLarge.bmp", thisAssembly);
cmdGroup.SmallIconList = iBmp.CreateFileFromResourceBitmap("EngToolsSW.ToolbarSmall.bmp", thisAssembly);
cmdGroup.LargeMainIcon = iBmp.CreateFileFromResourceBitmap("EngToolsSW.MainIconLarge.bmp", thisAssembly);
cmdGroup.SmallMainIcon = iBmp.CreateFileFromResourceBitmap("EngToolsSW.MainIconSmall.bmp", thisAssembly);

That is, it searches the images separately within the same bitmap as if it were or Array of images. In the Solidworks documentation it speaks this way:

The bitmap or PNG file should contain all of the images for all of the large Buttons and separators for this Commandgroup, in a single bitmap for Both Parent and Child toolbars. Each image of each button must be 24x24. The images should use a 256-color Palette. Use Gray (RGB 192, 192, 192) for Transparent areas in your Graphic.

You can only set this Property for the top-level Commandgroup.

available in this link.

How to create such a bitmap?

1 answer

1

Basically you add the file to your project in Visual Studio. Then you open the dialog box with the file properties. There will be a field with the name "Build Action" defines it as "Embedded Resource". After that you will be able to access these files the same way you are doing in the example. Just use the dll that Visual Studio generates.

Reference: http://support.microsoft.com/kb/319292

  • 1

    Ok Lucas, I already used the "Embedded Resource" option for images in the project, but my question is why is used a single bitmap file with several images that can be used separately according to an index of the class SmallIconList, do not understand how it is possible to create a bitmap of these with several images.

  • @Danielmasarin , if you call only that cmdGroup.LargeIconList. An array of bitmaps is returned?

  • No, a string is returned with the bitmap location.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.