/// <summary>Создание маленькой кнопки</summary> /// <param name="fName">Название функции (= параметр запуска функции)</param> /// <param name="lName">Локальное название функции</param> /// <param name="img">Иконка</param> /// <param name="description">Описание функции</param> /// <param name="fullDescription">Полное описание</param> /// <param name="helpImage">Имя файла картинки для ToolTip. Файл должен располагаться в каталоге /Resources/Help проекта</param> /// <param name="helpLink">Ссылка онлайн-справки, не включающая https://modplus.org/. Если null, то справка строится по имени функции</param> /// <returns></returns> public static RibbonButton AddSmallButton(string fName, string lName, string img, string description, string fullDescription, string helpImage, string helpLink) { try { var tt = new RibbonToolTip { IsHelpEnabled = true, Content = description, Command = fName, IsProgressive = true }; if (string.IsNullOrEmpty(helpLink)) { tt.HelpTopic = Language.RusWebLanguages.Contains(Language.CurrentLanguageName) ? $"https://modplus.org/ru/autocadplugins/{fName.ToLower()}" : $"https://modplus.org/en/autocadplugins/{fName.ToLower()}"; } else { tt.HelpTopic = Language.RusWebLanguages.Contains(Language.CurrentLanguageName) ? $"https://modplus.org/ru/{helpLink.ToLower()}" : $"https://modplus.org/en/{helpLink.ToLower()}"; } return(GetSmallRibbonButton(fName, lName, img, fullDescription, helpImage, tt)); } catch (Exception) { return(null); } }
private static void OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { // This is a workaround for the issue that BetweenShowDelay property does not // work as expected. Even though this property has been set to '0ms' on all of // the Ribbon controls with the expectation that ToolTips will always appear // after the InitialShowDelay, ToolTips show immediately without the // InitialShowDelay when moving between controls when ToolTips are already active. // Manually setting IsOpen to false upon detecting this scenario prevents the // quick show and always causes the system to wait for the InitialShowDelay to elapse. RibbonToolTip ribbonToolTip = (RibbonToolTip)d; UIElement placementTarget = ribbonToolTip.PlacementTarget; if (ribbonToolTip.IsOpen) { RibbonToolTipService.Current.CurrentToolTip = ribbonToolTip; if (placementTarget != null) { placementTarget.MouseLeave += new MouseEventHandler(ribbonToolTip.OnPlacementTargetMouseLeave); } } else { RibbonToolTipService.Current.CurrentToolTip = null; if (placementTarget != null) { placementTarget.MouseLeave -= new MouseEventHandler(ribbonToolTip.OnPlacementTargetMouseLeave); } } }
private static RibbonButton AddSmallButton(PlinesFunction function) { try { var ribbonToolTip = new RibbonToolTip { IsHelpEnabled = false, Content = function.Description, Command = function.Name, Title = function.LocalName }; var ribbonButton = new RibbonButton { CommandParameter = function.Name, Name = function.Name, CommandHandler = new RibbonCommandHandler(), Orientation = Orientation.Horizontal, Size = RibbonItemSize.Standard, ShowImage = true, ShowText = false, ToolTip = ribbonToolTip, Image = _colorTheme == 1 ? function.ImageSmall : function.ImageDarkSmall }; return(ribbonButton); } catch (Exception) { return(null); } }
public static RibbonToolTip ButtonToolTip(string resourceName, string resourcessemblyPath, string buttonContent, string buttonExpandendContent) { var tempPath = Path.Combine(Path.GetTempPath(), resourceName); using (Stream stream = Assembly .GetExecutingAssembly() .GetManifestResourceStream(resourcessemblyPath)) { var buffer = new byte[stream.Length]; stream.Read(buffer, 0, buffer.Length); using (FileStream fs = new FileStream(tempPath, FileMode.Create, FileAccess.Write)) { fs.Write(buffer, 0, buffer.Length); } } RibbonToolTip toolTip = new RibbonToolTip() { Content = buttonContent, ExpandedContent = buttonExpandendContent, ExpandedVideo = new Uri(Path.Combine(Path.GetTempPath(), resourceName)), IsHelpEnabled = true, IsProgressive = true }; return(toolTip); }
/// <summary>Создание большой кнопки</summary> /// <param name="fName">Название функции (= параметр запуска функции)</param> /// <param name="lName">Локальное название функции</param> /// <param name="img">Иконка</param> /// <param name="description">Описание функции</param> /// <param name="orientation">Ориентация кнопки: горизонтальная или вертикальная</param> /// <param name="fullDescription">Полное описание</param> /// <param name="helpImage">Имя файла картинки для ToolTip. Файл должен располагаться в каталоге /Resources/Help проекта</param> /// <returns></returns> public static RibbonButton AddBigButton( string fName, string lName, string img, string description, Orientation orientation, string fullDescription, string helpImage) { try { var tt = new RibbonToolTip { IsHelpEnabled = true, Content = description, Command = fName, IsProgressive = true, HelpTopic = Language.RusWebLanguages.Contains(Language.CurrentLanguageName) ? $"https://modplus.org/ru/autocadplugins/{fName.ToLower()}" : $"https://modplus.org/en/autocadplugins/{fName.ToLower()}" }; return(GetBigButton(fName, lName, img, orientation, fullDescription, helpImage, tt)); } catch (Exception) { return(null); } }
/// <summary> /// Property changed callback for tooltip footer properties. /// Sets the value of HasFooter property accordingly. /// </summary> private static void OnToolTipFooterPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { RibbonToolTip ribbonToolTip = (RibbonToolTip)d; ribbonToolTip.HasFooter = (!string.IsNullOrEmpty(ribbonToolTip.FooterTitle) || !string.IsNullOrEmpty(ribbonToolTip.FooterDescription) || ribbonToolTip.FooterImageSource != null); }
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 }
private void LoadAutomationTools() { //List<string> vaildUser = new List<string>(); //vaildUser.Add("michaelr"); //vaildUser.Add("clays"); //vaildUser.Add("russellw"); //vaildUser.Add("garthw"); //vaildUser.Add("craigp"); //vaildUser.Add("amandam"); //foreach (String user in vaildUser) //{ //if (user == Currentuser.ToLower()) //{ string m_detailPath = Path.Combine(_path, "DetailBuilder.dll"); if (File.Exists(m_detailPath)) { Autodesk.Revit.UI.RibbonPanel m_panelUtilities = GetRibbonPanelByTabName(CTabName, "Automation Tools"); PushButtonData m_pbData = GetPushButtonData("Detail Builder", "Detail \nBuilder", m_detailPath, "DetailBuilder.Command", "KirkseyAppsRibbon.Icons.DetailBuilder16.png", "KirkseyAppsRibbon.Icons.DetailBuilder32.png", "Formerly Project Seagul. *M*A*G*I*C*", ""); var button1 = m_panelUtilities.AddItem(m_pbData); var tempPath = Path.Combine(Path.GetTempPath(), "Magic.swf"); using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("KirkseyAppsRibbon.Magic.swf")) { var buffer = new byte[stream.Length]; stream.Read(buffer, 0, buffer.Length); using (FileStream fs = new FileStream( tempPath, FileMode.Create, FileAccess.Write)) { fs.Write(buffer, 0, buffer.Length); } } RibbonToolTip toolTip1 = new RibbonToolTip() { Title = "Detail Builder", Content = "Import standard details based on model componets", ExpandedContent = "Formerly Project Seagul. *M*A*G*I*C*", ExpandedVideo = new Uri(tempPath), HelpSource = new Uri("https://www.youtube.com/watch?v=U9t-slLl30E"), IsHelpEnabled = true, IsProgressive = true }; SetRibbonItemToolTip(button1, toolTip1); } //} //} }
private RibbonToolTip CreateToolTip(string title, string content) { RibbonToolTip toolTip = new RibbonToolTip(); //toolTip.Command = ""; toolTip.Title = title; toolTip.Content = content; toolTip.IsHelpEnabled = true; // Without this "Press F1 for help" does not appear in the tooltip return(toolTip); }
public static void RibbonDemo() { //新建新的Ribbon RibbonControl ribbonCtrl = ComponentManager.Ribbon; RibbonTab tab = new RibbonTab(); tab.Title = "MyRibbon"; tab.UID = "ACAD.MY_RibbonTab"; ribbonCtrl.Tabs.Add(tab); //新建RibbonPanelSource存放按钮,title等 RibbonPanelSource ribbonPanelSource = new RibbonPanelSource(); ribbonPanelSource.Title = "测试";//选项卡名字 //新建RibbonPanel,并将Pannelsource添加到RibbonPanel中 RibbonPanel ribbonPanel = new RibbonPanel(); ribbonPanel.Source = ribbonPanelSource; //将选项卡(RibbonPanel)添加到tab中 tab.Panels.Add(ribbonPanel); //添加按钮 RibbonButton btn = new RibbonButton(); btn.Name = "我是一个按钮提示"; //按钮提示标题 btn.Text = "按一下有惊喜"; //按钮文字 btn.ShowText = true; //让Button把准备好的文字显示出来 btn.IsVisible = true; //让按钮可见; //添加按钮帮助 RibbonToolTip toolTip = new RibbonToolTip(); //按钮提示对象 toolTip.Title = "我是按钮提示的标题"; //按钮提示标题 toolTip.Content = "我是按钮提示的内容"; //按钮提示内容 toolTip.Command = "AAAA"; //该按钮对应命令 //将按钮提示绑定到按钮上 btn.ToolTip = toolTip; //为按钮添加事件处理器 btn.CommandHandler = new Handler(); ////将按钮对应一个命令 //btn.CommandParameter = "AAAA "; (存疑!!!!) ribbonPanelSource.Items.Add(btn);//将按钮添加到PannelSource中 //在winform绘图需要一个GDI+类 }
private void StopMedia() { reminderSoundMedia.Source = null; playReminderSound.Tag = "Play"; RibbonToolTip tip = new RibbonToolTip(); tip.Title = "Play"; tip.Description = "Preview the selected reminder sound."; playReminderSound.ToolTip = tip; playPauseData.Data = PathGeometry.Parse("M 1.5 0 6.5 5 1.5 10 Z"); }
public static void SetRibbonItemToolTip(RibbonItem item, RibbonToolTip toolTip) { IUIRevitItemConverter itemConverter = new InternalMethodUIRevitItemConverter(); var ribbonItem = itemConverter.GetRibbonItem(item); if (ribbonItem == null) { return; } ribbonItem.ToolTip = toolTip; }
/// <summary> /// Property changed callback for tooltip PlacementTarget property. /// </summary> private static void OnPlacementTargetPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { RibbonToolTip ribbonToolTip = (RibbonToolTip)d; UIElement target = e.NewValue as UIElement; if (target == null) { ribbonToolTip.Ribbon = null; } else { ribbonToolTip.Ribbon = RibbonControlService.GetRibbon(target); } }
/// <summary> /// This CoerceValueCallback hack is used to determine whether the current PlacementTarget is within a RibbonGroup. /// </summary> private static object CoerceIsOpen(DependencyObject d, object value) { if ((bool)value) { RibbonToolTip toolTip = (RibbonToolTip)d; RibbonGroup ribbonGroup = null; UIElement placementTarget = toolTip.PlacementTarget; // Walk up the visual tree from the PlacementTarget to see if // it belongs to a RibbonGroup. DependencyObject element = placementTarget; while (element != null) { ribbonGroup = element as RibbonGroup; if (ribbonGroup != null) { break; } DependencyObject visualParent = VisualTreeHelper.GetParent(element); if (visualParent == null) { // This special check is for the case that the PlacementTarget is // within the Popup of a Collapsed RibbonGroup Popup popupParent = LogicalTreeHelper.GetParent(element) as Popup; if (popupParent != null) { ribbonGroup = popupParent.TemplatedParent as RibbonGroup; } break; } element = visualParent; } // A RibbonGroup is in the QAT is special. Its tooltip should show relative // to the mouse instead of under the Ribbon. All other control in the QAT // are automatically taken care of because they will not be recognized as // belonging to a RibbonGroup. bool isToolTipForRibbonGroup = ribbonGroup != null && (toolTip.PlacementTarget == ribbonGroup || (VisualTreeHelper.GetChildrenCount(ribbonGroup) > 0 && toolTip.PlacementTarget == VisualTreeHelper.GetChild(ribbonGroup, 0))); toolTip.IsPlacementTargetInRibbonGroup = (ribbonGroup != null && (!isToolTipForRibbonGroup || !ribbonGroup.IsInQuickAccessToolBar)); } return(value); }
private void PlayMedia() { reminderSoundMedia.Source = new Uri(@"Resources/Media/" + editReminderSound.SelectedItem.ToString(), UriKind.Relative); reminderSoundMedia.Play(); playReminderSound.Tag = "Stop"; RibbonToolTip tip = new RibbonToolTip(); tip.Title = "Stop"; tip.Description = "Stop playing the selected audio."; playReminderSound.ToolTip = tip; playPauseData.Data = PathGeometry.Parse("M 0.5 0.5 7.5 0.5 7.5 7.5 0.5 7.5 Z"); }
/// <summary> /// Returns help text /// </summary> protected override string GetHelpTextCore() { string helpText = base.GetHelpTextCore(); if (String.IsNullOrEmpty(helpText)) { RibbonToolTip toolTip = ((RibbonRadioButton)Owner).ToolTip as RibbonToolTip; if (toolTip != null) { helpText = toolTip.Description; } } return(helpText); }
//Only an Example static private void addRegistry(RibbonTab ribTab) { //create the panel source Autodesk.Windows.RibbonPanelSource ribSourcePanel = new RibbonPanelSource(); ribSourcePanel.Title = "Edit registry"; //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 = "Register WT-CAD"; ribButton1.CommandParameter = "REGISTERME "; ribButton1.ShowText = true; ribButton1.CommandHandler = new AdskCommandHandler(); //now create button 2 Autodesk.Windows.RibbonButton ribButton2 = new RibbonButton(); ribButton2.Text = "Unregister WT-CAD"; ribButton2.CommandParameter = "UNREGISTERME "; ribButton2.ShowText = true; ribButton2.CommandHandler = new AdskCommandHandler(); //create a tooltip Autodesk.Windows.RibbonToolTip ribToolTip = new RibbonToolTip(); ribToolTip.Command = "REGISTER WT-CAD"; ribToolTip.Title = "Register WT-CAD command"; ribToolTip.Content = "Register WT-CAD plugn on AutoCAD startup"; ribToolTip.ExpandedContent = "This commands adds or remove CAD-WT plugin in the list of registered plugins AutoCAD, When the command \"Register WT-CAD\" is activated, AutoCAD will start the CAD-WT when AutoCAD starts, and the command \"Unregister WT-CAD\" undo this initialization."; 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(); Autodesk.Windows.RibbonButton ribExpButton1 = new RibbonButton(); ribExpButton1.Text = "On expanded panel"; ribExpButton1.ShowText = true; ribExpPanel.Items.Add(ribExpButton1); //and add it to source ribSourcePanel.Items.Add(new RibbonPanelBreak()); ribSourcePanel.Items.Add(ribExpPanel); }
public btnTransparencyPercent(string text, int value, RibbonToolTip toolTip) { base.Id = (text); base.Name = (text); base.Text = (text); base.IsEnabled = (true); this.PercentValue = value; base.Size = (this.btnsize); base.ShowImage = (false); base.ShowText = (true); base.IsCheckable = (true); base.Image = (ArcGISRibbon.loadImage(this.smallImageName)); base.ToolTip = (Utility.CloneObject(toolTip)); base.CommandHandler = (new btn_TransparencyCommandHandler()); base.HelpSource = (ArcGISRibbon.HelpPath); base.ResizeStyle = (RibbonItemResizeStyles)(1); }
public static void Test() { Autodesk.Windows.RibbonControl rbnCtrl = Autodesk.AutoCAD.Ribbon.RibbonServices.RibbonPaletteSet.RibbonControl; //Add custom ribbon tab RibbonTab rbnTab = new RibbonTab { Title = "Custom commands", Id = TAB_ID }; rbnCtrl.Tabs.Add(rbnTab); rbnTab.IsActive = true; //Add custom ribbon panel RibbonPanel rbnPnl = new RibbonPanel { //Add ribbon panel source Source = new RibbonPanelSource { Title = "Custom Panel" } }; rbnTab.Panels.Add(rbnPnl); //Add custom ribbon button Autodesk.Windows.RibbonButton rbnBtn = new RibbonButton { Text = "ADN", CommandParameter = "ADN ", ShowText = true, Image = GetBitmap("RibbonToolTip_Case.Yoda.jpg", 16, 16), LargeImage = GetBitmap("RibbonToolTip_Case.Yoda.jpg", 32, 32), ShowImage = true }; Autodesk.Windows.RibbonToolTip rbnTT = new RibbonToolTip { Command = "ADN", Title = "Hello ADN", Content = "blah ..", ExpandedContent = "Expanded Blah ..." }; rbnBtn.ToolTip = rbnTT; rbnPnl.Source.Items.Add(rbnBtn); }
/// <summary> /// 添加命令按钮提示信息 /// </summary> /// <param name="ribbon">命令按钮</param> /// <param name="title">命令名</param> /// <param name="content">命令解释</param> /// <param name="command">快捷命令</param> /// <param name="expandedContent">命令拓展说明</param> /// <param name="imgFilePath">说明图片</param> /// <returns>RibbonToolTip</returns> public static RibbonToolTip AddRibbonToolTip(this RibbonButton ribbon, string title, string content, string command, string expandedContent, string imgFilePath) { RibbonToolTip ribbonToolTip = new RibbonToolTip() { Title = title, Content = content, Command = command, ExpandedContent = expandedContent }; if (imgFilePath != null) { Uri uri = new Uri(imgFilePath); BitmapImage bitmapImage = new BitmapImage(uri); ribbonToolTip.ExpandedImage = bitmapImage; } ribbon.ToolTip = ribbonToolTip; return(ribbonToolTip); }
public void Create() { RibbonTab tab = FindOrMakeTab("Add-ins"); // add to Add-Ins tab if (tab == null) { return; } RibbonPanelSource panel = CreateButtonPanel("Speckle 2", tab); if (panel == null) { return; } RibbonToolTip speckleTip = CreateToolTip("Speckle", "Speckle Connector for " + Utils.AppName); RibbonButton button = CreateButton("Connector " + Utils.AppName, "Speckle", panel, null, speckleTip, "logo"); // DUI2 RibbonButton button2 = CreateButton("Connector " + Utils.AppName + "New UI (alpha)!", "SpeckleNewUi", panel, null, speckleTip, "logo"); // help and resources buttons RibbonSplitButton helpButton = new RibbonSplitButton(); helpButton.Text = "Help & Resources"; helpButton.Image = LoadPngImgSource("help16.png"); helpButton.LargeImage = LoadPngImgSource("help32.png"); helpButton.ShowImage = true; helpButton.ShowText = true; helpButton.Size = RibbonItemSize.Large; helpButton.Orientation = Orientation.Vertical; panel.Items.Add(helpButton); RibbonToolTip communityTip = CreateToolTip("Community", "Check out our community forum! Opens a page in your web browser."); RibbonToolTip tutorialsTip = CreateToolTip("Tutorials", "Check out our tutorials! Opens a page in your web browser"); RibbonToolTip docsTip = CreateToolTip("Docs", "Check out our documentation! Opens a page in your web browser"); RibbonButton community = CreateButton("Community", "SpeckleCommunity", null, helpButton, communityTip, "forum"); RibbonButton tutorials = CreateButton("Tutorials", "SpeckleTutorials", null, helpButton, tutorialsTip, "tutorials"); RibbonButton docs = CreateButton("Docs", "SpeckleDocs", null, helpButton, docsTip, "docs"); }
public void CreateLegalDraftingRibbonPanel() { //get existing or create new ribbon panel if (GetExistingLegalDraftingRibbonPanel()) { return; } //Create new panel, if not exists _panelSource = new RibbonPanelSource(); _panelSource.Title = PANEL_TITLE; _ribbonPanel = new RibbonPanel(); _ribbonPanel.Source = _panelSource; _ribbonTab.Panels.Add(_ribbonPanel); //Add buttons RibbonButton button = new RibbonButton(); button.Text = "Legend"; button.CommandParameter = "LegalLegend "; button.ShowText = true; button.CommandHandler = new LegalDraftingRibbonCommandHandler(); RibbonToolTip toolTip = new RibbonToolTip(); toolTip.Command = "LegalLegend";; toolTip.Title = "Command: LegalLegend"; toolTip.Content = "Generate legal plan's legend list"; toolTip.ExpandedContent = "Generate legal plan's legend list " + "by searching drawing content visible in the viewports of layouts"; button.ToolTip = toolTip; _panelSource.Items.Add(button); _panelSource.Items.Add(new RibbonRowBreak()); }
/// <summary> /// Add this application command button to the /// specified Ribbon panel source /// </summary> /// <param name="ribSourcePanel">Ribbon panel source /// to add the button</param> private void AddCmdToRibbonPanel( RibbonPanelSource ribSourcePanel) { //create button RibbonButton ribCmdCutSurface = new RibbonButton(); ribCmdCutSurface.Text = "Cut Solid\non Surface"; ribCmdCutSurface.CommandParameter = ADNPCommand.CMD_CUT_SOLID_FROM_SURFACE; ribCmdCutSurface.ShowText = true; ribCmdCutSurface.ShowImage = true; ribCmdCutSurface.Size = RibbonItemSize.Large; ribCmdCutSurface.Orientation = System.Windows.Controls.Orientation.Vertical; ribCmdCutSurface.LargeImage = Util.LoadPNGImageFromResource( "ADNPlugin.Civil3D.SolidCutSurface.icon32.png"); ribCmdCutSurface.CommandHandler = new AdskCommandHandler(); //create a tooltip Autodesk.Windows.RibbonToolTip ribToolTip = new RibbonToolTip(); ribToolTip.Command = "CUTSURFACE"; ribToolTip.Title = "Cut Solid on Surface"; ribToolTip.Content = "Generate a Civil3D TIN Surface on the " + "bottom of an AutoCAD solid that cut/pass through " + "a Civil3D TIN Surface."; ribToolTip.ExpandedContent = "If the name of the TIN Surface " + "to create already exist, this command will erase all " + "points of the surface and add the newly generated points." + "\n\nThe number of points per AutoCAD unit of drawing " + "represent the number of points will be added to " + "the new surface along the edge length, higher " + "values result in more dense TIN surfaces."; ribCmdCutSurface.ToolTip = ribToolTip; ribSourcePanel.Items.Add(ribCmdCutSurface); }
public static RibbonButton AddButton( string fName, string lName, string img16, string img32, string description, Orientation orientation, string fullDescription, string helpImage, string helpLink = null) { try { var tt = new RibbonToolTip { IsHelpEnabled = true, Content = description, Command = fName, IsProgressive = true }; if (string.IsNullOrEmpty(helpLink)) { tt.HelpTopic = Language.RusWebLanguages.Contains(Language.CurrentLanguageName) ? $"https://modplus.org/ru/autocadplugins/{fName.ToLower()}" : $"https://modplus.org/en/autocadplugins/{fName.ToLower()}"; } else { tt.HelpTopic = Language.RusWebLanguages.Contains(Language.CurrentLanguageName) ? $"https://modplus.org/ru/{helpLink.ToLower()}" : $"https://modplus.org/en/{helpLink.ToLower()}"; } if (!string.IsNullOrEmpty(fullDescription)) { tt.ExpandedContent = fullDescription; } try { if (!string.IsNullOrEmpty(helpImage)) { tt.ExpandedImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(helpImage, UriKind.RelativeOrAbsolute)); } } catch { // ignored } var ribBtn = new RibbonButton { CommandParameter = tt.Command = fName, Name = tt.Title = lName, Text = ConvertLName(lName), CommandHandler = new RibbonCommandHandler(), Orientation = orientation, Size = RibbonItemSize.Large, ShowImage = true, ShowText = true, ToolTip = tt }; try { if (!string.IsNullOrEmpty(img16)) { ribBtn.Image = new System.Windows.Media.Imaging.BitmapImage(new Uri(img16, UriKind.RelativeOrAbsolute)); } if (!string.IsNullOrEmpty(img32)) { ribBtn.LargeImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(img32, UriKind.RelativeOrAbsolute)); } } catch { // ignored } return(ribBtn); } catch (Exception) { return(null); } }
public void YTBIM() { // 상하관계 : 탭 > 패널 > 패널 소스 > 갤러리 > 버튼 > 툴팁 // 생성순서 : 탭 -> 갤러리 -> 패널 소스 -> 버튼 -> 툴팁 -> 패널 // 리본 컨트롤 RibbonControl RC = ComponentManager.Ribbon; #region 탭 추가 // 메뉴탭에 탭 추가 RibbonTab RT = new RibbonTab(); RT.Name = "YT.BIM"; RT.Title = "YT.BIM"; RT.Id = "YTBIM ID"; RC.Tabs.Add(RT); #endregion #region 갤러리 추가 // 버튼이 담기는 갤러리 추가 // #1 콤보박스 갤러리 RibbonGallery RG1 = new RibbonGallery(); RG1.Name = "MyGallery1"; RG1.Id = "MyGalleryId1"; RG1.DisplayMode = GalleryDisplayMode.ComboBox; // #2 라지박스 갤러리 RibbonGallery RG2 = new RibbonGallery(); RG2.Name = "MyGallery2"; RG2.Id = "MyGalleryId2"; RG2.DisplayMode = GalleryDisplayMode.LargeButton; // #3 표준박스 갤러리 RibbonGallery RG3 = new RibbonGallery(); RG3.Name = "MyGallery3"; RG3.Id = "MyGalleryId3"; RG3.DisplayMode = GalleryDisplayMode.StandardButton; // #4 윈도우 갤러리 RibbonGallery RG4 = new RibbonGallery(); RG4.Name = "MyGallery4"; RG4.Id = "MyGalleryId4"; RG4.DisplayMode = GalleryDisplayMode.Window; #endregion #region 패널 소스에 갤러리 추가 // 패널 소스 추가 RibbonPanelSource RPS = new RibbonPanelSource(); RPS.Name = "YT AUTO BIM"; RPS.Title = "YT AUTO BIM"; RPS.Id = "MyPanelId"; RPS.Items.Add(RG1); RPS.Items.Add(RG2); RPS.Items.Add(RG3); RPS.Items.Add(RG4); #endregion #region 버튼 생성 // 버튼 1 RibbonButton B1 = new RibbonButton(); B1.Name = "기둥일람표 작성"; B1.Text = "기둥 일람표"; B1.Id = "MyButtonId1"; B1.ShowText = true; B1.ShowImage = true; B1.Image = Images.getBitmap(Properties.Resources.기둥일람표2_32x32_); B1.LargeImage = Images.getBitmap(Properties.Resources.기둥일람표2_32x32_); B1.Orientation = System.Windows.Controls.Orientation.Vertical; B1.Size = RibbonItemSize.Large; B1.CommandHandler = new RibbonCommandHandler(); // 버튼 1의 툴팁 RibbonToolTip rbnT1 = new RibbonToolTip(); rbnT1.Command = "Create Column Schedule"; rbnT1.Title = "YT AUTO COLUMN SCHEDULE"; rbnT1.Content = "Create column schedule automatically"; rbnT1.ExpandedContent = "In the opened window, input column data and click Just one button."; B1.ToolTip = rbnT1; // 버튼2 RibbonButton B2 = new RibbonButton(); B2.Name = "MyButton2"; B2.Text = "My Button2"; B2.Id = "MyButtonId2"; B2.Image = Images.getBitmap(Properties.Resources.기둥일람표2_32x32_); B2.LargeImage = Images.getBitmap(Properties.Resources.기둥일람표2_32x32_); B2.Size = RibbonItemSize.Large; B2.Orientation = System.Windows.Controls.Orientation.Vertical; B2.ShowText = true; // 버튼3 RibbonButton B3 = new RibbonButton(); B3.Name = "MyButton3"; B3.Text = "My Button3"; B3.Id = "MyButtonId3"; B3.Image = Images.getBitmap(Properties.Resources.기둥일람표2_32x32_); B3.LargeImage = Images.getBitmap(Properties.Resources.기둥일람표2_32x32_); B3.Size = RibbonItemSize.Large; B3.Orientation = System.Windows.Controls.Orientation.Vertical; B3.ShowText = true; // 버튼4 RibbonButton B4 = new RibbonButton(); B4.Name = "MyButton4"; B4.Text = "My Button4"; B4.Id = "MyButtonId4"; B4.Image = Images.getBitmap(Properties.Resources.기둥일람표2_32x32_); B4.LargeImage = Images.getBitmap(Properties.Resources.기둥일람표2_32x32_); B4.Size = RibbonItemSize.Large; B4.Orientation = System.Windows.Controls.Orientation.Vertical; B4.ShowText = true; #endregion #region 갤러리에 버튼 추가 RG1.Items.Add(B1); RG2.Items.Add(B1); RG3.Items.Add(B1); RG4.Items.Add(B1); RG1.Items.Add(B2); RG2.Items.Add(B2); RG3.Items.Add(B2); RG4.Items.Add(B2); RG1.Items.Add(B3); RG2.Items.Add(B3); RG3.Items.Add(B3); RG4.Items.Add(B3); RG1.Items.Add(B4); RG2.Items.Add(B4); RG3.Items.Add(B4); RG4.Items.Add(B4); #endregion #region 패널에 일반 버튼 추가 // 일반 패널 RibbonRowPanel RRP = new RibbonRowPanel(); RRP.Items.Add(B1); RRP.Items.Add(new RibbonSeparator()); RRP.Items.Add(B2); RRP.Items.Add(B3); RRP.Items.Add(B4); RPS.Items.Add(RRP); // 탭에 패널 추가 RibbonPanel RP = new RibbonPanel(); RP.Source = RPS; RT.Panels.Add(RP); //RT.Panels.Add(RPS); #endregion }
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); }
/// <summary> /// Initialize Automation Peer for RibbonToolTip /// </summary> public RibbonToolTipAutomationPeer(RibbonToolTip owner) : base(owner) { }
public static bool AddRibbon() { RibbonControl rc = ComponentManager.Ribbon; string tabId = "MyTools"; var tabs = rc.Tabs.Select(d => d.Id).ToList(); if (tabs.Contains(tabId)) { var tab = rc.Tabs.FirstOrDefault(d => d.Id == tabId); rc.Tabs.Remove(tab); } try { RibbonTab rt = new RibbonTab { Title = "我的工具", Id = tabId, IsActive = true }; rc.Tabs.Add(rt); RibbonPanel rp = new RibbonPanel(); rt.Panels.Add(rp); RibbonPanelSource rps = new RibbonPanelSource(); rps.Title = "车位工具"; rp.Source = rps; string btnName = "添加车位"; RibbonButton rb = new RibbonButton { Name = btnName, Text = btnName, ShowText = true, Image = Properties.Resources.AddCar.GetBitmapImage(16), LargeImage = Properties.Resources.AddCar.GetBitmapImage(32), Orientation = System.Windows.Controls.Orientation.Vertical, CommandHandler = new RibbonCommandHandler(), CommandParameter = "AddCar", Size = RibbonItemSize.Large }; rps.Items.Add(rb); RibbonToolTip rtt = new RibbonToolTip { Title = "添加车位", Content = "添加车位的功能", Command = "AddCar", ExpandedContent = "添加车位,排序及统计", ExpandedImage = Properties.Resources.AddCarToolTip.GetBitmapImage(), }; rb.ToolTip = rtt; return(true); } catch { return(false); } }
private static RibbonButton GetSmallRibbonButton(string fName, string lName, string img, string fullDescription, string helpImage, RibbonToolTip tt) { if (!string.IsNullOrEmpty(fullDescription)) { tt.ExpandedContent = fullDescription; } try { if (!string.IsNullOrEmpty(helpImage)) { tt.ExpandedImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(helpImage, UriKind.RelativeOrAbsolute)); } } catch { // ignored } var ribBtn = new RibbonButton { CommandParameter = tt.Command = fName, Name = tt.Title = lName, CommandHandler = new RibbonCommandHandler(), Orientation = Orientation.Horizontal, Size = RibbonItemSize.Standard, ShowImage = true, ShowText = false, ToolTip = tt }; try { if (!string.IsNullOrEmpty(img)) { ribBtn.Image = new System.Windows.Media.Imaging.BitmapImage(new Uri(img, UriKind.RelativeOrAbsolute)); } } catch { // ignored } return(ribBtn); }
public static void Toolbar(UIControlledApplication application) { // Create tab string tabName = "BIMicon"; application.CreateRibbonTab(tabName); // Create ribbon Autodesk.Revit.UI.RibbonPanel panelLibrary = application.CreateRibbonPanel(tabName, "Library"); Autodesk.Revit.UI.RibbonPanel panelModelling = application.CreateRibbonPanel(tabName, "Modelling"); Autodesk.Revit.UI.RibbonPanel panelProject = application.CreateRibbonPanel(tabName, "Project"); Autodesk.Revit.UI.RibbonPanel panelSchedules = application.CreateRibbonPanel(tabName, "Schedules"); Autodesk.Revit.UI.RibbonPanel panelSheets = application.CreateRibbonPanel(tabName, "Sheets"); Autodesk.Revit.UI.RibbonPanel panelSupport = application.CreateRibbonPanel(tabName, "Support"); // Retrieve assembly path string assemblyPath = Assembly.GetExecutingAssembly().Location; // Help url for BIMicon items in the ribbon string urlHelp = @"https://www.bimicon.com/bimicon-plugin/"; ContextualHelp contextHelpUrl = new ContextualHelp(ContextualHelpType.Url, urlHelp); /*---Ribbon Panel Library---*/ #region Ribbon Panel Library // Duplicate sheets PushButtonData buttonRemoveBackups = new PushButtonData( "RemoveBackups", "Remove\nBackups", assemblyPath, "BIMiconToolbar.RemoveBackups.RemoveBackups" ); PushButton pbRemoveBackups = panelLibrary.AddItem(buttonRemoveBackups) as PushButton; pbRemoveBackups.LargeImage = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/RemoveBackups/Images/iconRemoveBackup.png")); pbRemoveBackups.Image = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/RemoveBackups/Images/iconRemoveBackupSmall.png")); pbRemoveBackups.ToolTip = "Remove Revit backup files."; pbRemoveBackups.LongDescription = "Remove Revit backup files from selected folder including subfolders."; pbRemoveBackups.AvailabilityClassName = "BIMiconToolbar.Tab.CommandAvailability"; // Set the context help when F1 pressed pbRemoveBackups.SetContextualHelp(contextHelpUrl); // File Rename PushButtonData buttonFilesRename = new PushButtonData( "FilesRename", "Rename\nFiles", assemblyPath, "BIMiconToolbar.FilesRename.FilesRename" ); PushButton pbFilesRename = panelLibrary.AddItem(buttonFilesRename) as PushButton; pbFilesRename.LargeImage = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/FilesRename/Images/iconFilesRename.png")); pbFilesRename.Image = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/FilesRename/Images/iconFilesRenameSmall.png")); pbFilesRename.ToolTip = "Rename the files inside a folder."; pbFilesRename.LongDescription = "Rename all files of a certain type inside a folder."; pbFilesRename.AvailabilityClassName = "BIMiconToolbar.Tab.CommandAvailability"; // Set the context help when F1 pressed pbFilesRename.SetContextualHelp(contextHelpUrl); // Family Browser PushButtonData buttonFamilyBrowser = new PushButtonData( "FamilyBrowser", "Family\nBrowser", assemblyPath, "BIMiconToolbar.FamilyBrowser.FamilyBrowser" ); PushButton pbFamilyBrowser = panelLibrary.AddItem(buttonFamilyBrowser) as PushButton; pbFamilyBrowser.LargeImage = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/FamilyBrowser/Images/iconFamilyBrowser.png")); pbFamilyBrowser.Image = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/FamilyBrowser/Images/iconFamilyBrowserSmall.png")); pbFamilyBrowser.ToolTip = "Open a dockable panel to search and load families."; pbFamilyBrowser.LongDescription = "Open a dockable panel that allows searching and browsing families."; // Set the context help when F1 pressed pbFamilyBrowser.SetContextualHelp(contextHelpUrl); #endregion /*---Ribbon Panel Library---*/ #region Ribbon Panel Modelling // Duplicate sheets PushButtonData buttonFloorFinish = new PushButtonData( "Floor Finish", "Floor\nFinish", assemblyPath, "BIMiconToolbar.FloorFinish.FloorFinish" ); PushButton pbFloorFinish = panelModelling.AddItem(buttonFloorFinish) as PushButton; pbFloorFinish.LargeImage = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/FloorFinish/Images/iconFloorFinish.png")); pbFloorFinish.Image = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/FloorFinish/Images/iconFloorFinishSmall.png")); pbFloorFinish.ToolTip = "Create floor finishes by selecting rooms."; pbFloorFinish.LongDescription = "Create floor finishes by selecting rooms and floor type."; // Set the context help when F1 pressed pbFloorFinish.SetContextualHelp(contextHelpUrl); #endregion /*---Ribbon Panel Schedules---*/ #region Ribbon Panel Schedules // Export Schedules PushButtonData buttonExportSchedules = new PushButtonData( "ExportSchedules", "Export\nSchedules", assemblyPath, "BIMiconToolbar.ExportSchedules.ExportSchedules" ); PushButton pbExportSchedules = panelSchedules.AddItem(buttonExportSchedules) as PushButton; pbExportSchedules.LargeImage = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/ExportSchedules/Images/iconSchedulesExcel.png")); pbExportSchedules.Image = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/ExportSchedules/Images/iconSchedulesExcelSmall.png")); pbExportSchedules.ToolTip = "Export selected schedules."; pbExportSchedules.LongDescription = "Export selected schedules to the selected destination."; // Set the context help when F1 pressed pbExportSchedules.SetContextualHelp(contextHelpUrl); // Warnings Review PushButtonData buttonWarningsReport = new PushButtonData( "WarningsReport", "Warnings\nReport", assemblyPath, "BIMiconToolbar.WarningsReport.WarningsReport" ); PushButton pbWarningsReport = panelSchedules.AddItem(buttonWarningsReport) as PushButton; pbWarningsReport.LargeImage = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/WarningsReport/Images/iconWarningsReview.png")); pbWarningsReport.Image = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/WarningsReport/Images/iconWarningsReviewSmall.png")); pbWarningsReport.ToolTip = "Generate Warnings report."; pbWarningsReport.LongDescription = "Exports a Warnings report classified by priority."; // Set the context help when F1 pressed pbWarningsReport.SetContextualHelp(contextHelpUrl); #endregion /*---Ribbon Panel Sheets---*/ #region Ribbon Panel Sheets // Duplicate sheets PushButtonData buttonDuplicateSheets = new PushButtonData( "DuplicateSheets", "Duplicate\nSheets", assemblyPath, "BIMiconToolbar.DuplicateSheets.DuplicateSheets" ); PushButton pbDuplicateSheets = panelSheets.AddItem(buttonDuplicateSheets) as PushButton; pbDuplicateSheets.LargeImage = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/DuplicateSheets/Images/iconDupSheets.png")); pbDuplicateSheets.Image = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/DuplicateSheets/Images/iconDupSheetsSmall.png")); pbDuplicateSheets.ToolTip = "Duplicate active sheet."; pbDuplicateSheets.LongDescription = "Duplicate current active sheet with detailing and annotation elements."; // Set the context help when F1 pressed pbDuplicateSheets.SetContextualHelp(contextHelpUrl); // View on Sheet PushButtonData buttonViewOnSheet = new PushButtonData( "ViewOnSheet", "View on\nSheet", assemblyPath, "BIMiconToolbar.ViewOnSheet.ViewOnSheet" ); PushButton pbViewOnSheet = panelSheets.AddItem(buttonViewOnSheet) as PushButton; pbViewOnSheet.LargeImage = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/ViewOnSheet/Images/iconViewOnSheet.png")); pbViewOnSheet.Image = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/ViewOnSheet/Images/iconViewOnSheetSmall.png")); pbViewOnSheet.ToolTip = "Place active view on selected sheet."; pbViewOnSheet.LongDescription = "Place active view on selected sheet."; // Set the context help when F1 pressed pbViewOnSheet.SetContextualHelp(contextHelpUrl); #endregion /*---Ribbon Panel Project---*/ #region Ribbon Panel Project //Create push buttons for panelProject PushButtonData buttonNumberDoors = new PushButtonData( "NumberDoors", "Number\nDoors", assemblyPath, "BIMiconToolbar.NumberDoors.NumberDoors2020" ); PushButton pbNumberDoors = panelProject.AddItem(buttonNumberDoors) as PushButton; pbNumberDoors.LargeImage = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/NumberDoors/Images/iconNumberDoors.png")); pbNumberDoors.Image = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/NumberDoors/Images/iconNumberDoorsSmall.png")); RibbonToolTip numberDoorsToolTip = Auxiliar.ButtonToolTip("NumberDoorsHelp.mp4", "BIMiconToolbar.NumberDoors.Images.NumberDoorsHelp.mp4", "Number doors according to room number.", "Assigns a door number according to room. The primary parameter to use for door number" + "is picked from the ToRoom paramter from the door. If there is no room on either side" + "of the door, no number will be assigned."); Auxiliar.SetRibbonItemToolTip(pbNumberDoors, numberDoorsToolTip); // Set the context help when F1 pressed pbNumberDoors.SetContextualHelp(contextHelpUrl); // Number Windows PushButtonData buttonNumberWindows = new PushButtonData( "NumberWindows", "Number\nWindows", assemblyPath, "BIMiconToolbar.NumberWindows.NumberWindows" ); PushButton pbNumberWindows = panelProject.AddItem(buttonNumberWindows) as PushButton; pbNumberWindows.LargeImage = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/NumberWindows/Images/iconNumberWindows.png")); pbNumberWindows.Image = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/NumberWindows/Images/iconNumberWindowsSmall.png")); pbNumberWindows.ToolTip = "Number windows according to room number."; pbNumberWindows.LongDescription = "Assigns a window number according to room. The primary parameter to use for window number" + "is picked from the ToRoom paramter from the window. If there is no room on either side" + "of the window, no number will be assigned."; // Set the context help when F1 pressed pbNumberWindows.SetContextualHelp(contextHelpUrl); // Number by Spline PushButtonData buttonNumberBySpline = new PushButtonData( "NumberBySpline", "Number\nby Spline", assemblyPath, "BIMiconToolbar.NumberBySpline.NumberBySpline" ); PushButton pbNumberBySpline = panelProject.AddItem(buttonNumberBySpline) as PushButton; pbNumberBySpline.LargeImage = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/NumberBySpline/Images/iconNumberBySpline.png")); pbNumberBySpline.Image = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/NumberBySpline/Images/iconNumberBySpline.png")); pbNumberBySpline.ToolTip = "Number elements by intersecting with selected spline."; pbNumberBySpline.LongDescription = "Number elements of a selected category by interseting the bounding box with selected spline."; // Set the context help when F1 pressed pbNumberBySpline.SetContextualHelp(contextHelpUrl); // Match grids PushButtonData buttonMatchGrids = new PushButtonData( "MatchGrids", "Match\nGrids", assemblyPath, "BIMiconToolbar.MatchGrids.MatchGrids" ); PushButton pbMatchGrids = panelProject.AddItem(buttonMatchGrids) as PushButton; pbMatchGrids.LargeImage = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/MatchGrids/Images/iconMatchGrids.png")); pbMatchGrids.Image = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/MatchGrids/Images/iconMatchGridsSmall.png")); pbMatchGrids.ToolTip = "Match grids display from one view to all selected views"; pbMatchGrids.LongDescription = "Match grids display from one view to all other selected views."; // Set the context help when F1 pressed pbMatchGrids.SetContextualHelp(contextHelpUrl); // Mark Origin PushButtonData buttonMarkOrigin = new PushButtonData( "MarkerOrigin", "Mark\nOrigin", assemblyPath, "BIMiconToolbar.MarkOrigin.MarkOrigin" ); PushButton pbMarkOrigin = panelProject.AddItem(buttonMarkOrigin) as PushButton; pbMarkOrigin.LargeImage = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/MarkOrigin/Images/iconMarkerOrigin.png")); pbMarkOrigin.Image = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/MarkOrigin/Images/iconMarkerOrigin.png")); pbMarkOrigin.ToolTip = "Marks in the current view Revit's internal origin"; pbMarkOrigin.LongDescription = "Marks in the current view Revit's internal origin"; // Set the context help when F1 pressed pbMarkOrigin.SetContextualHelp(contextHelpUrl); // Interior Elevations PushButtonData buttonInteriorElevations = new PushButtonData( "InteriorElevations", "Interior\nElevations", assemblyPath, "BIMiconToolbar.InteriorElevations.InteriorElevations" ); PushButton pbInteriorElevations = panelProject.AddItem(buttonInteriorElevations) as PushButton; pbInteriorElevations.LargeImage = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/InteriorElevations/Images/iconInteriorElev.png")); pbInteriorElevations.Image = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/InteriorElevations/Images/iconInteriorElevSmall.png")); pbInteriorElevations.ToolTip = "Creates interior elevations from selected rooms"; pbInteriorElevations.LongDescription = "Creates interior elevations from selected rooms and place them onto sheets"; // Set the context help when F1 pressed pbInteriorElevations.SetContextualHelp(contextHelpUrl); #endregion /*--- Ribbon Panel Support ---*/ #region Panel Support //Create buttons for panelSupport PushButtonData buttonVersion = new PushButtonData( "Version", "Version", assemblyPath, "BIMiconToolbar.Support.Version.Version"); PushButtonData buttonDocumentation = new PushButtonData( "Documentation", "Docs", assemblyPath, "BIMiconToolbar.Support.Docs.Docs"); PushButtonData buttonHelp = new PushButtonData( "Help", "Help", assemblyPath, "BIMiconToolbar.Support.Help.Help"); // Stacked items for stacked buttons IList <Autodesk.Revit.UI.RibbonItem> stackedSupport = panelSupport.AddStackedItems(buttonHelp, buttonDocumentation, buttonVersion); // Defining buttons PushButton pbHelp = stackedSupport[0] as PushButton; pbHelp.ToolTip = "Get Help"; pbHelp.LongDescription = "Contact us for any query or help"; BitmapImage pbHelpImage = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/Support/Help/Images/iconHelpSmall.png")); pbHelp.Image = pbHelpImage; pbHelp.AvailabilityClassName = "BIMiconToolbar.Tab.CommandAvailability"; // Set the context help when F1 pressed pbHelp.SetContextualHelp(contextHelpUrl); PushButton pbDocumentation = stackedSupport[1] as PushButton; pbDocumentation.ToolTip = "Documentation"; pbDocumentation.LongDescription = "Check our online documentation"; BitmapImage pbDocumentationImage = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/Support/Docs/Images/iconDocSmall.png")); pbDocumentation.Image = pbDocumentationImage; pbDocumentation.AvailabilityClassName = "BIMiconToolbar.Tab.CommandAvailability"; // Set the context help when F1 pressed pbDocumentation.SetContextualHelp(contextHelpUrl); PushButton pbVersion = stackedSupport[2] as PushButton; pbVersion.ToolTip = "Display current version"; pbVersion.LongDescription = "Retrieves current version"; BitmapImage pbVersionImageSmall = new BitmapImage(new Uri("pack://application:,,,/BIMiconToolbar;component/Support/Version/Images/iconVersionSmall.png")); pbVersion.Image = pbVersionImageSmall; pbVersion.AvailabilityClassName = "BIMiconToolbar.Tab.CommandAvailability"; // Set the context help when F1 pressed pbVersion.SetContextualHelp(contextHelpUrl); #endregion }