3 Replies Latest reply on Oct 11, 2012 9:30 AM by Lee CS Young

    Creating a Menu Command with Visual Basic .Net

    Arun Samuel

      Dear Sir,

           i'd tried below menu command coding but not show toolbarImage

       

      Public Sub GetAddInInfo(ByRef poInfo As EdmLib.EdmAddInInfo, ByVal poVault As EdmLib.IEdmVault5, ByVal poCmdMgr As   EdmLib.IEdmCmdMgr5) Implements EdmLib.IEdmAddIn5.GetAddInInfo

      poInfo.mbsAddInName = "Menu command sample"
      poInfo.mbsCompany = "SolidWorks Corporation"
      poInfo.mbsDescription = "Adds menu items and toolbar buttons"
      poInfo.mlAddInVersion = 1
      poInfo.mlRequiredVersionMajor = 12
      poInfo.mlRequiredVersionMinor = 2

       

      iNormalBmp = My.Resources.Resource1.ToolbarNormal.GetHbitmap.ToInt32
      iHotBmp = My.Resources.Resource1.ToolbarHot.GetHbitmap.ToInt32
       
      poCmdMgr.AddToolbarImage(iHotBmp, 2, EdmButtonState.BState_Hot, False, True, &HC0C0C0, 99)

      poCmdMgr.AddCmd(1000, "First command", EdmMenuFlags.EdmMenu_HasToolbarButton, "This is the first command", "First command", 0, 99)

      poCmdMgr.AddCmd(1001, "Second command", EdmMenuFlags.EdmMenu_HasToolbarButton Or EdmMenuFlags.EdmMenu_MustHaveSelection, "This is the second command", "Second command", 1, 99)

      End Sub

       

      Public Sub OnCmd(ByRef poCmd As EdmLib.EdmCmd, ByRef ppoData As System.Array) Implements EdmLib.IEdmAddIn5.OnCmd

       

               Dim frm As New Form1

                frm.Show()

      End Sub