Message 1 of 2
AddIn: display the button-icon (Visual Studio 2015/ C#)
Not applicable
08-14-2017
01:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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:
Regards
Patrick
