/// <summary> /// 创建一个按钮 /// </summary> /// <param name="plugin"></param> /// <param name="panel"></param> private static void CreateButton(IFangCommand plugin, RibbonPanel panel) { if (plugin.SplitName != null && plugin.SplitName != "") { SplitButton splitbt = FindSplitByName(panel, plugin.SplitName); if (splitbt != null) { PushButtonData data = new PushButtonData(plugin.AlaisName, plugin.AlaisName, plugin.GetType().Assembly.Location, plugin.ModelName); PushButton ps = splitbt.AddPushButton(data); ps.LargeImage = plugin.ImageURI; ps.Image = plugin.ImageURI; ps.SetShortCut(plugin.ShortCutKey); } else { SplitButtonData splidata = new SplitButtonData(plugin.SplitName, plugin.SplitName); SplitButton ps = panel.AddItem(splidata) as SplitButton; ps.LargeImage = plugin.ImageURI; ps.Image = plugin.ImageURI; ps.SetShortCut(plugin.ShortCutKey); ps.IsSynchronizedWithCurrentItem = false; //ps.ItemText = plugin.SplitName; } } else { } }
/// <summary> /// 附加按钮 /// </summary> /// <param name="b1"></param> /// <param name="plugins"></param> private static void AppendPullButton(PulldownButton b1, List <IFangCommand> plugins) { foreach (var plugin in plugins) { PushButtonData data = new PushButtonData(plugin.AlaisName, plugin.AlaisName, plugin.GetType().Assembly.Location, plugin.ModelName); PushButton ps = b1.AddPushButton(data); ps.LargeImage = plugin.ImageURI; ps.Image = plugin.ImageURI; ps.SetShortCut(plugin.ShortCutKey); } }