Пытаемся добавить контекстное меню в часть. Не показываю, что бы я ни делал! (
Также невозможно найти функцию обратного вызова при нажатии на нее (когда я ее получу).
Код: Выделить всё
internal static SldWorks SwApp;
internal static int cookie;
public bool ConnectToSW(object ThisSW, int Cookie)
{
SwApp = (SldWorks)ThisSW;
cookie = Cookie;
ICommandManager icmd = SwApp.GetCommandManager(cookie);
ICommandGroup cmdGroup;
var a = icmd.AddContextMenu(1, "Test");
a.SelectType = (int)swSelectType_e.swSelEVERYTHING; //tried other options too
a.AddCommandItem2("Test2", -1, "hint", "tool tip", 1, "Booom", "", 1, (int)(swCommandItemType_e.swMenuItem));
a.ShowInDocumentType = (int)swDocumentTypes_e.swDocPART;
a.HasMenu = true;
//a.Activate(); //cannot be set on contextmenu object. only on CommandGroup.
//cmdGroup.AddCommandGroup2(); // working. Im able to add both menu and toolbar (but not contextmenu)
return true;
}
Подробнее здесь: https://stackoverflow.com/questions/792 ... nu-c-sharp
Мобильная версия