/// <summary> /// Add the core elements of the ui /// </summary> /// <param name="ironstoneTab">The tab to add the ui elements to</param> private void CreateCoreMenu(RibbonTab ironstoneTab) { RibbonPanel panel = new RibbonPanel(); RibbonPanelSource source = new RibbonPanelSource { Title = "General" }; RibbonRowPanel stack = new RibbonRowPanel(); RibbonToggleButton aboutButton = UIHelper.CreateWindowToggle(Resources.ExtensionApplication_AboutWindow_Name, Resources.About, RibbonItemSize.Standard, _container.GetRequiredService <About>(), "10992236-c8f6-4732-b5e0-2d9194f07068"); RibbonButton feedbackButton = UIHelper.CreateButton(Resources.ExtensionApplication_UI_BtnFeedback, Resources.Feedback, RibbonItemSize.Standard, "Core_Feedback"); RibbonToggleButton reviewButton = UIHelper.CreateWindowToggle(Resources.ExtensionApplication_ReviewWindow_Name, Resources.Review, RibbonItemSize.Large, _container.GetRequiredService <Review>(), "18cd4414-8fc8-4978-9e97-ae3915e29e07"); RibbonToggleButton libraryButton = UIHelper.CreateWindowToggle(Resources.ExtensionApplication_LibraryWindow_Name, Resources.Library_Small, RibbonItemSize.Standard, _container.GetRequiredService <Libraries>(), "08ccb73d-6e6b-4ea0-8d99-61bbeb7c20af"); RibbonRowPanel column = new RibbonRowPanel { IsTopJustified = true }; column.Items.Add(aboutButton); column.Items.Add(new RibbonRowBreak()); column.Items.Add(feedbackButton); column.Items.Add(new RibbonRowBreak()); column.Items.Add(libraryButton); stack.Items.Add(column); stack.Items.Add(reviewButton); //Add the new tab section to the main tab source.Items.Add(stack); panel.Source = source; ironstoneTab.Panels.Add(panel); }
private RibbonButton CreateButton(string name, string CommandParameter, RibbonPanelSource sourcePanel = null, RibbonSplitButton sourceButton = null, RibbonToolTip tooltip = null, string imageName = "") { var button = new RibbonButton(); // ribbon panel source info assignment button.Text = name; button.Id = name; button.ShowImage = true; button.ShowText = true; button.ToolTip = tooltip; button.HelpSource = new System.Uri("https://speckle.guide/user/autocadcivil.html"); button.Size = RibbonItemSize.Large; button.Image = LoadPngImgSource(imageName + "16.png"); button.LargeImage = LoadPngImgSource(imageName + "32.png"); // add ribbon button pannel to the ribbon panel source if (sourcePanel != null) { button.Orientation = Orientation.Vertical; button.CommandParameter = CommandParameter; button.CommandHandler = new ButtonCommandHandler(CommandParameter); sourcePanel.Items.Add(button); } else if (sourceButton != null) { button.Orientation = Orientation.Horizontal; button.CommandParameter = CommandParameter; button.CommandHandler = new ButtonCommandHandler(CommandParameter); sourceButton.Items.Add(button); } return(button); }
public void CreateMicroGDSRibbon() { try { RibbonTab rbnTab = new RibbonTab(); rbnTab.Title = "MicroGDS"; rbnTab.Id = "MicroGDS_Id"; Autodesk.Windows.RibbonPanelSource rbnSource = new RibbonPanelSource(); rbnSource.Title = "Batch Plotting"; RibbonPanel rbnPanel = new RibbonPanel(); RibbonButton pan1button1 = new RibbonButton(); pan1button1.Text = "Batch Potting"; pan1button1.ShowText = true; pan1button1.ShowImage = true; //pan1button1.Image = Images.getBitmap(Properties.Resources.batch); //pan1button1.LargeImage = Images.getBitmap(Properties.Resources.large); pan1button1.Orientation = System.Windows.Controls.Orientation.Vertical; pan1button1.Size = RibbonItemSize.Large; pan1button1.CommandHandler = new BatchPlotingCommandHandler(); rbnSource.Items.Add(pan1button1); rbnPanel.Source = rbnSource; rbnTab.IsActive = true; rbnTab.Panels.Add(rbnPanel); //Autodesk.Windows.ComponentManager.Ribbon.Tabs.Add(rbnTab); } catch (System.Exception ex) { } }
/// <summary> /// construct the menu panel for Layer Print /// </summary> /// <param name="ribTab"></param> private void addPanel2(RibbonTab ribTab) { //create the panel source RibbonPanelSource ribPanelSource = new RibbonPanelSource(); ribPanelSource.Title = "打印操作"; //create the panel RibbonPanel ribPanel = new RibbonPanel(); ribPanel.Source = ribPanelSource; ribTab.Panels.Add(ribPanel); //create button1 RibbonButton ribButtonPrint = new RibbonButton(); ribButtonPrint.Text = "打印图层"; ribButtonPrint.ShowText = true; ribButtonPrint.Image = GetBitmapImage("D:\\Projects\\AutoCAD\\Code\\MyProject\\img\\print_32.png"); //BitmapImage bmi = new BitmapImage(new Uri("D:\\Projects\\AutoCAD\\Code\\MyProject\\img\\printer.png")); //double i = bmi.Width; //double j = bmi.Height; //ribButtonPrint.LargeImage = bmi; ribButtonPrint.ShowImage = true; //pay attention to the SPACE after the command name ribButtonPrint.CommandParameter = "PrintAllLayer "; ribButtonPrint.CommandHandler = new AdskCommandHandler(); ribPanelSource.Items.Add(ribButtonPrint); }
private static void SetPanelItemsVisibility(RibbonPanelSource panelSource, bool visibility) { foreach (var item in panelSource.Items) { item.IsVisible = visibility; } }
private void _pastToPanelAtSimpleRow(RibbonCommandButtonAttribute ribbAttr, CommandMethodAttribute cmdAttr, Type type, string id) { RibbonButton button = new RibbonButton(); button.IsToolTipEnabled = true; button.Id = type.FullName + id; button.Name = cmdAttr.GlobalName; button.Orientation = System.Windows.Controls.Orientation.Horizontal; button.ShowText = true; button.GroupName = ribbAttr.GroupName; button.CommandHandler = new RibbonButtonCommandHandler(); button.CommandParameter = cmdAttr.GlobalName; button.Size = RibbonItemSize.Standard; button.Text = ribbAttr.Name; button.GroupLocation = Autodesk.Private.Windows.RibbonItemGroupLocation.Last; string name = ribbAttr.GroupName; RibbonPanel panel = _ribbonTab.Panels.FirstOrDefault(p => p.Source.Title == name); if (panel == null) { panel = new RibbonPanel(); RibbonPanelSource source = new RibbonPanelSource(); source.Id = ribbAttr.GroupName + "___source_owner"; source.Title = button.GroupName; panel.Source = source; _ribbonTab.Panels.Add(panel); //panel.Source.IsSlideOutPanelVisible = true; panel.CanToggleOrientation = true; panel.ResizeStyle = RibbonResizeStyles.NeverHideText; //panel.CustomPanelTitleBarBackground = System.Windows.Media.Brushes.LightYellow; } RibbonItem row = panel.Source.Items.FirstOrDefault(x => { if (x is RibbonRowPanel) { if (((RibbonRowPanel)x).Items.Count / 2 < 3) { return(true); } } return(false); }); if (row == null) { row = new RibbonRowPanel(); row.Id = panel.Source.Id + "." + type.FullName + "_row"; row.Name = type.Name; panel.Source.Items.Add(row); } ((RibbonRowPanel)row).Items.Add(button); if (row is RibbonRowPanel) { ((RibbonRowPanel)row).Items.Add(new RibbonRowBreak()); } }
/// <summary> /// Creates the ribbon button for this application /// </summary> private void CreateRibbon() { RibbonControl ribCntrl = RibbonServices.RibbonPaletteSet.RibbonControl; //can also be Autodesk.Windows.ComponentManager.Ribbon; foreach (RibbonTab ribTab in ribCntrl.Tabs) { if (ribTab.Title == "Add-Ins") { Autodesk.Windows.RibbonPanelSource ribSourcePanel = null; foreach (RibbonPanel ribPnl in ribTab.Panels) { if (ribPnl.Source.Title == "PIOTM") { ribSourcePanel = ribPnl.Source; } } if (ribSourcePanel == null) { //create the panel source ribSourcePanel = new RibbonPanelSource(); ribSourcePanel.Title = "PIOTM"; //now the panel RibbonPanel ribPanel = new RibbonPanel(); ribPanel.Source = ribSourcePanel; ribTab.Panels.Add(ribPanel); } AddCmdToRibbonPanel(ribSourcePanel); return; } } }
public static RibbonPanelSource AddNewPanel( this RibbonTabSource instance, string name, string text = null) { if (text == null) { text = name; } var ribbonRoot = instance.CustomizationSection.MenuGroup.RibbonRoot; var panels = ribbonRoot.RibbonPanelSources; var id = "pnl" + name; var ribbonPanelSource = new RibbonPanelSource(ribbonRoot); ribbonPanelSource.Name = name; ribbonPanelSource.Text = text; ribbonPanelSource.Id = id; ribbonPanelSource.ElementID = id; panels.Add(ribbonPanelSource); var ribbonPanelSourceReference = new RibbonPanelSourceReference(instance); ribbonPanelSourceReference.PanelId = ribbonPanelSource.ElementID; instance.Items.Add(ribbonPanelSourceReference); return(ribbonPanelSource); }
public void Initialize() { RibbonControl rc = Autodesk.Windows.ComponentManager.Ribbon; RibbonTab JPPTab = rc.FindTab("JPPCORE_JPP_TAB"); if (JPPTab == null) { JPPTab = JPP.Core.JPPMain.CreateTab(); } RibbonPanel Panel = new RibbonPanel(); RibbonPanelSource source = new RibbonPanelSource(); RibbonRowPanel StructureRow = new RibbonRowPanel(); source.Title = "Civil Structures"; Dictionary <string, UserControl> ucs = new Dictionary <string, UserControl>(); ucs.Add("Site Settings", new SiteFoundationControl()); foundationUI = new UIPanelToggle(StructureRow, JPP.CivilStructures.Properties.Resources.spade, "Foundations", new Guid("4bcb33a2-0771-4d96-a2f0-9a96229ff393"), ucs); //Build the UI hierarchy source.Items.Add(StructureRow); Panel.Source = source; JPPTab.Panels.Add(Panel); }
public static void addWPFControls() { RibbonControl rbnCtrl = ComponentManager.Ribbon; if (rbnCtrl == null) { return; } RibbonPanelSource srcPanel = new RibbonPanelSource(); srcPanel.Title = "Panel hosting WPF Controls"; srcPanel.Id = "PanelWithWPF"; RibbonPanel panel = new RibbonPanel(); panel.Source = srcPanel; RibbonTab tab = new RibbonTab(); tab.Title = "Tab with WPF Controls"; tab.Id = "TabWPF"; tab.Panels.Add(panel); rbnCtrl.Tabs.Add(tab); System.Windows.Controls.StackPanel wrapPanel = new System.Windows.Controls.StackPanel(); Class1 class1 = new Class1(); wrapPanel.Children.Add(class1.InitRibbonView((int)SystemParameters.PrimaryScreenWidth, 360)); wrapPanel.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; panel.SetWPFControl(wrapPanel, "test"); var productName = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute)).OfType <AssemblyProductAttribute>().FirstOrDefault().Product; }
/// <summary> /// Панель "Оси" /// </summary> private static void AddAxisPanel(RibbonTab ribbonTab) { var ribSourcePanel = new RibbonPanelSource { Title = Language.GetItem(Invariables.LangItem, "tab3") }; var ribPanel = new RibbonPanel { Source = ribSourcePanel }; ribbonTab.Panels.Add(ribPanel); var ribRowPanel = new RibbonRowPanel(); // mpAxis var ribbonButton = GetBigButton(AxisDescriptor.Instance); if (ribbonButton != null) { ribRowPanel.Items.Add(ribbonButton); } if (ribRowPanel.Items.Any()) { ribSourcePanel.Items.Add(ribRowPanel); } }
static private void addRefMgr(RibbonTab ribTab) { //create the panel source Autodesk.Windows.RibbonPanelSource ribSourcePanel = new RibbonPanelSource(); ribSourcePanel.Title = "References"; //now the panel RibbonPanel ribPanel = new RibbonPanel(); ribPanel.Source = ribSourcePanel; ribTab.Panels.Add(ribPanel); //create button Refm Autodesk.Windows.RibbonButton ribButton1 = new RibbonButton(); ribButton1.Orientation = System.Windows.Controls.Orientation.Vertical; BitmapImage bmpI = ArCaUtils.GetBitmapImage(ArCaManaged.Properties.Resources.RefMgr); ribButton1.LargeImage = bmpI; ribButton1.Image = bmpI; ribButton1.Size = RibbonItemSize.Large; ribButton1.Text = "Reference Manager"; ribButton1.ShowText = true; ribButton1.CommandParameter = "refm "; ribButton1.ShowImage = true; ribButton1.CommandHandler = new AdskCommandHandler(); ribSourcePanel.Items.Add(ribButton1); }
private static void AddPanel(RibbonTab ribTab, IEnumerable <PlinesFunction> functions) { var ribbonPanelSource = new RibbonPanelSource { Title = Language.GetItem(PlinesEditFunction.LangItem, "h9") }; var ribbonPanel = new RibbonPanel { Source = ribbonPanelSource }; // add buttons var i = 0; var ribbonRowPanel = new RibbonRowPanel(); foreach (var plinesFunction in functions) { if (i % 4 == 0) { ribbonRowPanel.Items.Add(new RibbonRowBreak()); } ribbonRowPanel.Items.Add(AddSmallButton(plinesFunction)); i++; } ribbonPanelSource.Items.Add(ribbonRowPanel); // add panel to ribbon tab var contain = ribTab.Panels.Any(panel => panel.Source.Title.Equals(Language.GetItem(PlinesEditFunction.LangItem, "h9"))); if (!contain) { ribTab.Panels.Insert(ribTab.Panels.Count - 1, ribbonPanel); } }
public void InitRbControl() { RibbonControl rbnCtrl = ComponentManager.Ribbon; // Init Panel Source RibbonPanelSource srcPanel = new RibbonPanelSource(); srcPanel.Title = ""; srcPanel.Id = "CustomPanel"; RibbonPanel panel = new RibbonPanel(); panel.Source = srcPanel; RibbonTab tab = new RibbonTab(); tab.Title = "Custom Tab Telerik"; tab.Id = "CustomTab"; tab.Panels.Add(panel); rbnCtrl.Tabs.Add(tab); System.Windows.Controls.StackPanel wrapPanel = new System.Windows.Controls.StackPanel(); string XMLName = "//Data_UI.xml"; string CurrentDirectory = Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory())); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(CurrentDirectory + XMLName); XmlNodeList = xmlDoc.DocumentElement.SelectNodes("/RadRibbonView/RadRibbonTab"); ReadXml(XmlNodeList); wrapPanel.Children.Add(radRibbonView); wrapPanel.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; panel.SetWPFControl(wrapPanel, "test"); }
private void addPanel2(RibbonTab ribTab) { //create the panel source RibbonPanelSource ribPanelSource = new RibbonPanelSource(); ribPanelSource.Title = "Edit Registry"; //create the panel RibbonPanel ribPanel = new RibbonPanel(); ribPanel.Source = ribPanelSource; ribTab.Panels.Add(ribPanel); //create button1 RibbonButton ribButtonDrawCircle = new RibbonButton { Text = "My Draw Circle", ShowText = true, // LargeImage = LoadImage(null), // 参数值不能为 null //pay attention to the SPACE after the command name CommandParameter = "DrawCircle ", CommandHandler = new AdskCommandHandler() }; // ribPanelSource.Items.Add(ribButtonDrawCircle); }
/// <summary> /// Computation panel creation /// </summary> /// <returns>Computations panel</returns> public RibbonPanel AddCompPanel() { RibbonPanelSource rps = new RibbonPanelSource { Title = "Computations", Name = "Computations", }; RibbonPanel rp = new RibbonPanel { Source = rps }; RibbonButton GroupPoints = ButtonLarge.Clone() as RibbonButton; GroupPoints.Text = $"Group Comp{Environment.NewLine}Points"; GroupPoints.CommandParameter = "_.CreateGroupOfCalcs "; GroupPoints.LargeImage = IntFunctions.BitmapToImageSource(Properties.Resources.Create_PG); RibbonButton ExportGroup = ButtonLarge.Clone() as RibbonButton; ExportGroup.Text = $"Export Point{Environment.NewLine}Groups"; ExportGroup.CommandParameter = "_.ExportPointGroups "; ExportGroup.LargeImage = IntFunctions.BitmapToImageSource(Properties.Resources.Export_PG); rps.Items.Add(GroupPoints); rps.Items.Add(ExportGroup); return(rp); }
static RibbonPanel AddOnePanel() { RibbonButton plotThisButton; RibbonPanelSource rps = new RibbonPanelSource(); rps.Title = "Plotting"; RibbonPanel rp = new RibbonPanel(); rp.Source = rps; //Create a Command Item that the Dialog Launcher can use, // for this test it is just a place holder. RibbonButton rci = new RibbonButton(); //rci.Name = "TestCommand"; //assign the Command Item to the DialgLauncher which auto-enables // the little button at the lower right of a Panel rps.DialogLauncher = rci; plotThisButton = new RibbonButton(); plotThisButton.Name = "Plot"; plotThisButton.ShowText = true; plotThisButton.Text = "Plot"; plotThisButton.CommandHandler = new MyRibbonCommandHandler(); plotThisButton.CommandParameter = "HelloWorld "; //Add the Button to the Tab rps.Items.Add(plotThisButton); return(rp); }
/// <summary> /// Добавить панель "Утилиты" /// </summary> private static void AddToolsPanel(RibbonTab ribbonTab) { // create the panel source var ribSourcePanel = new RibbonPanelSource { Title = Language.GetItem(Invariables.LangItem, "tab9") }; // now the panel var ribPanel = new RibbonPanel { Source = ribSourcePanel }; ribbonTab.Panels.Add(ribPanel); var ribRowPanel = new RibbonRowPanel(); ribRowPanel.Items.Add( RibbonHelpers.AddBigButton( "mpESKDSearch", Language.GetItem(Invariables.LangItem, "tab10"), _colorTheme == 1 // 1 - light ? $"pack://application:,,,/mpESKD_{ModPlusConnector.Instance.AvailProductExternalVersion};component/Resources/SearchEntities_32x32.png" : $"pack://application:,,,/mpESKD_{ModPlusConnector.Instance.AvailProductExternalVersion};component/Resources/SearchEntities_32x32_dark.png", Language.GetItem(Invariables.LangItem, "tab5"), Orientation.Vertical, string.Empty, string.Empty, "help/mpeskd")); ribSourcePanel.Items.Add(ribRowPanel); }
public static void CreateSharedElements() { if (HousingConceptTab == null) { HousingConceptTab = new RibbonTab(); HousingConceptTab.Title = Resources.ExtensionApplication_UI_HousingContextTabTitle; } if (!GeneralDesignCreated) { RibbonPanel generalPanel = new RibbonPanel(); RibbonPanelSource generalSource = new RibbonPanelSource(); RibbonRowPanel hcolumn1 = new RibbonRowPanel(); hcolumn1.IsTopJustified = true; var cmdNewPlotMaster = UIHelper.GetCommandGlobalName(typeof(SharedHouseCommands), nameof(SharedHouseCommands.CreateDetailPlotMaster)); var btnNewPlotMaster = UIHelper.CreateButton(Resources.SharedUIHelper_UI_NewPlotMaster, Resources.Houses_Small, RibbonItemSize.Standard, cmdNewPlotMaster); hcolumn1.Items.Add(btnNewPlotMaster); generalSource.Items.Add(hcolumn1); generalSource.Title = Resources.ExtensionApplication_UI_HousingDesignTabTitle; generalPanel.Source = generalSource; RibbonControl rc = Autodesk.Windows.ComponentManager.Ribbon; RibbonTab primaryTab = rc.FindTab(Jpp.Ironstone.Core.Constants.IronstoneTabId); primaryTab.Panels.Add(generalPanel); GeneralDesignCreated = true; } CreateBlockTab(); }
/// <summary> /// Панель "Линии" /// </summary> private static void AddLinesPanel(RibbonTab ribbonTab) { // create the panel source var ribSourcePanel = new RibbonPanelSource { Title = Language.GetItem(Invariables.LangItem, "tab1") }; // now the panel var ribPanel = new RibbonPanel { Source = ribSourcePanel }; ribbonTab.Panels.Add(ribPanel); var ribRowPanel = new RibbonRowPanel(); // mpBreakLine ribRowPanel.Items.Add(GetSplitButton(BreakLineDescriptor.Instance)); // mpGroundLine ribRowPanel.Items.Add(GetSplitButton(GroundLineDescriptor.Instance)); // mpWaterProofing ribRowPanel.Items.Add(GetSplitButton(WaterProofingDescriptor.Instance)); if (ribRowPanel.Items.Any()) { ribSourcePanel.Items.Add(ribRowPanel); } }
public static RibbonPanelSource AddRibbonPanel(string tabAlias, string panelAlias, string panelText) { var fileName = Application.GetSystemVariable("MENUNAME") as string; var custSect = new CustomizationSection(fileName); RibbonRoot ribbonRoot = custSect.MenuGroup.RibbonRoot; RibbonPanelSource ribbonPanel = ribbonRoot.FindPanelWithAlias(panelAlias); if (ribbonPanel != null) { return(null); } ribbonPanel = new RibbonPanelSource(ribbonRoot); ribbonPanel.Aliases.Add(panelAlias); ribbonPanel.Name = panelAlias; ribbonPanel.Text = panelText; ribbonPanel.Items.Clear(); ribbonRoot.RibbonPanelSources.Add(ribbonPanel); RibbonTabSource tab = ribbonRoot.FindTabWithAlias(tabAlias); var panelRef = new RibbonPanelSourceReference(tab); panelRef.PanelId = ribbonPanel.ElementID; tab.Items.Add(panelRef); return(ribbonPanel); }
public static RibbonPanelSource AddRibbonPanelToTab(CustomizationSection cs, string tabName, string panelName) { RibbonRoot root = cs.MenuGroup.RibbonRoot; RibbonPanelSourceCollection panels = root.RibbonPanelSources; foreach (RibbonTabSource rts in root.RibbonTabSources) { if (rts.Name == tabName) { //Create the ribbon panel source and add it to the ribbon panel source collection RibbonPanelSource panelSrc = new RibbonPanelSource(root); panelSrc.Text = panelSrc.Name = panelName; panelSrc.ElementID = panelSrc.Id = panelName + "_PanelSourceID"; panels.Add(panelSrc); //Create the ribbon panel source reference and add it to the ribbon panel source reference collection RibbonPanelSourceReference ribPanelSourceRef = new RibbonPanelSourceReference(rts); ribPanelSourceRef.PanelId = panelSrc.ElementID; rts.Items.Add(ribPanelSourceRef); return(panelSrc); } } return(null); }
/// <summary> /// Add the core elements of the ui /// </summary> /// <param name="JPPTab">The tab to add the ui elements to</param> public static void CreateCoreMenu(RibbonTab JPPTab) { RibbonPanel Panel = new RibbonPanel(); RibbonPanelSource source = new RibbonPanelSource(); source.Title = "General"; RibbonRowPanel stack = new RibbonRowPanel(); /*RibbonButton finaliseButton = Utilities.CreateButton("Finalise Drawing", Properties.Resources.package, RibbonItemSize.Standard, "Finalise"); * stack.Items.Add(finaliseButton); * stack.Items.Add(new RibbonRowBreak());*/ /*RibbonButton authenticateButton = Utilities.CreateButton("Authenticate", Properties.Resources.Locked, RibbonItemSize.Standard, ""); * stack.Items.Add(authenticateButton); * stack.Items.Add(new RibbonRowBreak());*/ //Create the button used to toggle the settings on or off _settingsButton = new RibbonToggleButton(); _settingsButton.ShowText = true; _settingsButton.ShowImage = true; _settingsButton.Text = "Settings"; _settingsButton.Name = "Display the settings window"; _settingsButton.CheckStateChanged += settingsButton_CheckStateChanged; _settingsButton.Image = Core.Utilities.LoadImage(Properties.Resources.settings); _settingsButton.Size = RibbonItemSize.Standard; _settingsButton.Orientation = System.Windows.Controls.Orientation.Horizontal; stack.Items.Add(_settingsButton); stack.Items.Add(new RibbonRowBreak()); //Add the new tab section to the main tab source.Items.Add(stack); Panel.Source = source; JPPTab.Panels.Add(Panel); }
static RibbonPanel AddOnePanel() { RibbonButton plotThisButton; RibbonPanelSource rps = new RibbonPanelSource(); rps.Title = "Plotting"; RibbonPanel rp = new RibbonPanel(); rp.Source = rps; //Create a Command Item that the Dialog Launcher can use, // for this test it is just a place holder. RibbonButton rci = new RibbonButton(); //rci.Name = "TestCommand"; //assign the Command Item to the DialgLauncher which auto-enables // the little button at the lower right of a Panel rps.DialogLauncher = rci; plotThisButton = new RibbonButton(); plotThisButton.Name = "Plot"; plotThisButton.ShowText = true; plotThisButton.Text = "Plot"; plotThisButton.CommandHandler = new MyRibbonCommandHandler(); plotThisButton.CommandParameter = "HelloWorld "; //Add the Button to the Tab rps.Items.Add(plotThisButton); return rp; }
/// <summary> /// Панель "Выноски" /// </summary> private static void AddLeadersPanel(RibbonTab ribbonTab) { var ribSourcePanel = new RibbonPanelSource { Title = Language.GetItem("tab15") }; var ribPanel = new RibbonPanel { Source = ribSourcePanel }; ribbonTab.Panels.Add(ribPanel); var ribRowPanel = new RibbonRowPanel(); // mpNodalLeader var ribbonButton = GetBigButton(NodalLeader.GetDescriptor()); if (ribbonButton != null) { ribRowPanel.Items.Add(ribbonButton); } // mpSecantNodalLeader ribbonButton = GetSmallButton(SecantNodalLeader.GetDescriptor()); if (ribbonButton != null) { ribRowPanel.Items.Add(ribbonButton); } if (ribRowPanel.Items.Any()) { ribSourcePanel.Items.Add(ribRowPanel); } }
public static RibbonRow AddNewRibbonRow(this RibbonPanelSource instance) { var row = new RibbonRow(instance); instance.Items.Add(row); return(row); }
public static RibbonPanel ribbonPanel(string Title) { RibbonPanelSource ribSourcePanel = new RibbonPanelSource(); ribSourcePanel.Title = Title; RibbonPanel ribPanel = new RibbonPanel(); ribPanel.Source = ribSourcePanel; return(ribPanel); }
/// <summary> /// 创建菜单面板 /// </summary> /// <param name="Title">面板名</param> /// <returns></returns> public static RibbonPanel RibbonPanel(string Title) { RibbonPanelSource ribSourcePanel = new RibbonPanelSource(); // Autodesk.Windows ribSourcePanel.Title = Title; //now the panel RibbonPanel ribPanel = new RibbonPanel(); ribPanel.Source = ribSourcePanel; return(ribPanel); }
public static RibbonPanel RibbonPanel() { RibbonPanelSource ribSoucePanel = new RibbonPanelSource(); ribSoucePanel.Title = PANEL_TITLE; RibbonPanel ribPanel = new RibbonPanel(); ribPanel.Source = ribSoucePanel; return(ribPanel); }
private void AddPanel1(RibbonTab ribTab) { //create the panel source Autodesk.Windows.RibbonPanelSource ribSourcePanel = new RibbonPanelSource(); ribSourcePanel.Title = "廓形"; //now the panel RibbonPanel ribPanel = new RibbonPanel(); ribPanel.Source = ribSourcePanel; ribTab.Panels.Add(ribPanel); //create button 1 Autodesk.Windows.RibbonButton ribButton1 = new RibbonButton(); ribButton1.Text = "H型"; ribButton1.CommandParameter = "REGISTERME "; ribButton1.ShowText = true; ribButton1.CommandHandler = new AdskCommandHandler(); //now create button 2 Autodesk.Windows.RibbonButton ribButton2 = new RibbonButton(); ribButton2.Text = "Y型"; ribButton2.CommandParameter = "UNREGISTERME "; ribButton2.ShowText = true; ribButton2.CommandHandler = new AdskCommandHandler(); //create a tooltip Autodesk.Windows.RibbonToolTip ribToolTip = new RibbonToolTip(); ribToolTip.Command = "REGISTERME"; ribToolTip.Title = "Register me command"; ribToolTip.Content = "Register this assembly on AutoCAD startup"; ribToolTip.ExpandedContent = "Add the necessary registry key to allow this assembly to auto load on startup. Also check which event you should add handle to add custom ribbon on AutoCAD startup."; ribButton1.ToolTip = ribToolTip; //now add the 2 button with a RowBreak ribSourcePanel.Items.Add(ribButton1); ribSourcePanel.Items.Add(new RibbonRowBreak()); ribSourcePanel.Items.Add(ribButton2); //now add and expanded panel (with 1 button) Autodesk.Windows.RibbonRowPanel ribExpPanel = new RibbonRowPanel(); //and add it to source ribSourcePanel.Items.Add(ribExpPanel);//needs to be here Autodesk.Windows.RibbonButton ribExpButton1 = new RibbonButton(); ribExpButton1.Text = "A型"; ribExpButton1.ShowText = true; ribExpButton1.CommandParameter = "LINE "; ribExpButton1.CommandHandler = new AdskCommandHandler(); ribExpPanel.Items.Add(ribExpButton1); //ribSourcePanel.Items.Add(new RibbonPanelBreak()); //ribSourcePanel.Items.Add(ribExpPanel);//needs to be above }
public void CreateUI() { var cmdBlockFromPointAtGradient = UIHelper.GetCommandGlobalName(typeof(LevelBlockCommands), nameof(LevelBlockCommands.CalculateLevelFromPointAtGradient)); var cmdBlockFromBlockAtGradient = UIHelper.GetCommandGlobalName(typeof(LevelBlockCommands), nameof(LevelBlockCommands.CalculateLevelFromLevelBlockAtGradient)); var cmdBlockFromBlockWithInvert = UIHelper.GetCommandGlobalName(typeof(LevelBlockCommands), nameof(LevelBlockCommands.CalculateLevelFromLevelBlockWithInvert)); var cmdBlockBetweenBlocks = UIHelper.GetCommandGlobalName(typeof(LevelBlockCommands), nameof(LevelBlockCommands.CalculateLevelBetweenLevels)); var cmdGradientBetweenBlocks = UIHelper.GetCommandGlobalName(typeof(GradientBlockCommands), nameof(GradientBlockCommands.CalculateGradientBetweenLevels)); var cmdPolylineFromLevelBlocks = UIHelper.GetCommandGlobalName(typeof(PolylineCommands), nameof(PolylineCommands.GeneratePolyline3dFromLevels)); var btnBlockFromPointAtGradient = UIHelper.CreateButton(Resources.ExtensionApplication_UI_BtnLevelBlockFromPointAtGradient, Resources.level_block_small, RibbonItemSize.Standard, cmdBlockFromPointAtGradient); var btnBlockFromBlockAtGradient = UIHelper.CreateButton(Resources.ExtensionApplication_UI_BtnLevelBlockFromBlockAtGradient, Resources.level_block_small, RibbonItemSize.Standard, cmdBlockFromBlockAtGradient); var btnBlockBetweenBlocks = UIHelper.CreateButton(Resources.ExtensionApplication_UI_BtnBlockBetweenBlocks, Resources.level_block_small, RibbonItemSize.Standard, cmdBlockBetweenBlocks); var btnBlockFromBlockWithInvert = UIHelper.CreateButton(Resources.ExtensionApplication_UI_BtnLevelBlockFromBlockWithInvert, Resources.level_block_small, RibbonItemSize.Standard, cmdBlockFromBlockWithInvert); var btnGradientBetweenBlocks = UIHelper.CreateButton(Resources.ExtensionApplication_UI_BtnGradientBetweenBlocks, Resources.gradient_large, RibbonItemSize.Standard, cmdGradientBetweenBlocks); var btnPolylineFromLevelBlocks = UIHelper.CreateButton(Resources.ExtensionApplication_UI_BtnPolylineFromLevelBlocks, Resources.line_from_levels_small, RibbonItemSize.Standard, cmdPolylineFromLevelBlocks); var btnSplitLevel = new RibbonSplitButton { ShowText = true, IsSynchronizedWithCurrentItem = false, Text = Resources.ExtensionApplication_UI_BtnLevelBlocks, Image = UIHelper.LoadImage(new Bitmap(Resources.level_block_large, new Size(16, 16))), IsSplit = false }; btnSplitLevel.Items.Add(btnBlockFromPointAtGradient); btnSplitLevel.Items.Add(btnBlockFromBlockAtGradient); btnSplitLevel.Items.Add(btnBlockFromBlockWithInvert); btnSplitLevel.Items.Add(btnBlockBetweenBlocks); var source = new RibbonPanelSource { Title = Resources.ExtensionApplication_UI_PanelTitle }; var column = new RibbonRowPanel { IsTopJustified = true }; column.Items.Add(btnSplitLevel); column.Items.Add(new RibbonRowBreak()); column.Items.Add(btnGradientBetweenBlocks); column.Items.Add(new RibbonRowBreak()); column.Items.Add(btnPolylineFromLevelBlocks); source.Items.Add(column); var panel = new RibbonPanel { Source = source }; var ribbon = ComponentManager.Ribbon; var tab = ribbon.FindTab(Constants.IRONSTONE_CONCEPT_TAB_ID); tab.Panels.Add(panel); }