Kommentar
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
Initializes a new instance of the RibbonButton class.
Namespace: Microsoft.Office.Tools.Ribbon
Assembly: Microsoft.Office.Tools.Common.v9.0 (in Microsoft.Office.Tools.Common.v9.0.dll)
Syntax
'Declaration
Public Sub New
'Usage
Dim instance As New RibbonButton()
public RibbonButton()
public:
RibbonButton()
public function RibbonButton()
Remarks
Visual Studio Tools for Office creates an instance of this class for you when you drag a Button from the Office Ribbon Controls tab of the Toolbox onto the Ribbon Designer.
You can also create an instance of this control at run time and add it to a dynamic menu.
Examples
The following example creates two instances of the RibbonButton class and adds them to a menu. To run this code example, you must first perform the following steps:
Add a Ribbon (Visual Designer) item to a Visual Studio Tools for Office project.
Add a group to the custom tab.
Add a menu to the group.
Set the Dynamic property of the menu to true.
Private Sub PopulateDynamicMenu()
menu1.Items.Add(New RibbonButton())
CType(menu1.Items.Last(), RibbonButton).Label = "Button 1"
menu1.Items.Add(New RibbonButton())
CType(menu1.Items.Last(), RibbonButton).Label = "Button 2"
End Sub
private void PopulateDynamicMenu()
{
menu1.Items.Add(new RibbonButton());
((RibbonButton)menu1.Items.Last()).Label = "Button 1";
menu1.Items.Add(new RibbonButton());
((RibbonButton)menu1.Items.Last()).Label = "Button 2";
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.Office.Tools.Ribbon Namespace