Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Anonymous
1009 Views, 1 Reply

AddIn: display the button-icon (Visual Studio 2015/ C#)

Hello,

I'm having problems to convert my icon (ico) to the correct format. I already created the following button:

 

            Ribbons ribbons = m_inventorApplication.UserInterfaceManager.Ribbons;
            Ribbon partRibbon = m_inventorApplication.UserInterfaceManager.Ribbons[2]; //Part
            // add new panel
            RibbonTab myTab = partRibbon.RibbonTabs.Add("my Tab", "myTab", m_clientId);
            // add new tab
            RibbonPanel myPanel = myTab.RibbonPanels.Add("my Panel", "myPanel", m_clientId);

            // icons
            Icon bigIcon = InvAddIn.Properties.Resources.big;
            Icon smallIcon = InvAddIn.Properties.Resources.small;

            //HOW TO CONVERT ICON TO PICTURE?

            // button definition
            ControlDefinitions controlDefinitions = m_inventorApplication.CommandManager.ControlDefinitions;
            ButtonDefinition myButtonDef = controlDefinitions.AddButtonDefinition("my Button", "myButton", CommandTypesEnum.kNonShapeEditCmdType, m_clientId, StandardIcon: smallPicture, LargeIcon: largePicture);

            // add the button to the new panel
            myPanel.CommandControls.AddButton(myButtonDef);

 

 

I took a look at the "SimpleAddin" (DeveloperTools\Samples\VCSharp.NET\AddIns\SimpleAddIn). Its not working for me:

image.png

Regards

Patrick