1 Reply Latest reply on Apr 28, 2017 10:23 AM by Pablo Fernández

    AddinToolbarButton

    Pablo Fernández

      Does the method IEdmCmdMgr5.AddToolbarImage actually work?

      I've been trying to add an image to a menu command with no success after many attempts.

      Heres a  C# piece of code that I think should work.

      The resource "dim" is a bitmap 16x16x8bit

       

                  Bitmap dim = AddinRevisionPDF.Properties.Resources.dim;
                  poCmdMgr.AddToolbarImage(dim.GetHbitmap().ToInt32(), 1, EdmButtonState.BState_Cold, false,true, 12632256, 99);
                  poCmdMgr.AddCmd(1, "Control Dimensional", (int)(EdmMenuFlags.EdmMenu_MustHaveSelection | EdmMenuFlags.EdmMenu_OnlyFiles | EdmMenuFlags.EdmMenu_OnlySingleSelection | EdmMenuFlags.EdmMenu_HasToolbarButton | EdmMenuFlags.EdmMenu_HastItemToolbarButton), "Asigna el archivo a un usuario para controlar cotas", "", 0, 99);
      

       

      Thanks

        • Re: AddinToolbarButton
          Pablo Fernández

          I found the answer in the knowledge base

           

          SPR #: 951769

          Summary: SOLIDWORKS PDM -API, Help – Documentation: Help for IEdmCmdMgr5::AddToolbarImage should indicate that this API does not work with Windows Vista and later

           

          Also I found that there is no way of drawing the button using IEdmAddInDrawButton5.DrawToolbarButton

          SPR #: 733185

          Summary: Add-ins that implement IEdmAddInDrawButton5::DrawToolbarButton do not create dynamic toolbar buttons

           

          So apparently, correct  me if Im wrong, there is no way of adding an icon to your menu commands.

          This has not been solved since windows Vista!