一个成熟的软件怎么能没有ribbon呢,在前面的框架基础上再加个命令AddRibbon
vbnet
<CommandMethod("AddRibbon")>
Public Sub AddRibbon()
Dim ribbonControl As RibbonControl = ComponentManager.Ribbon
Dim tab As RibbonTab = New RibbonTab()
tab.Title = "我的插件"
ribbonControl.Tabs.Add(tab)
Dim panelSource As RibbonPanelSource = New RibbonPanelSource()
panelSource.Title = "我的面板"
Dim panel As RibbonPanel = New RibbonPanel()
panel.Source = panelSource
tab.Panels.Add(panel)
Dim Button1 As RibbonButton = New RibbonButton()
Button1.Text = "我的按钮"
Button1.Tag = "BUTTON1"
Button1.ShowImage = True
Dim iconPath As String = "C:\Users\Administrator\source\repos\MyCADNet\bin\x64\Debug\ico.png"
Button1.Image = New BitmapImage(New Uri(iconPath))
Button1.LargeImage = New BitmapImage(New Uri(iconPath))
Button1.ShowText = True
'Button1.CommandHandler = New RibbonCommandHandler()
panelSource.Items.Add(Button1)
End Sub