共用方式為


RibbonFactory Interface

Provides methods that you can use to create Ribbon controls for a Microsoft Office Ribbon customization.

Namespace:  Microsoft.Office.Tools.Ribbon
Assemblies:   Microsoft.Office.Tools.Common.v4.0.Utilities (in Microsoft.Office.Tools.Common.v4.0.Utilities.dll)
  Microsoft.Office.Tools.Common (in Microsoft.Office.Tools.Common.dll)

Syntax

'Declaration
<GuidAttribute("1012BDD2-303F-4464-A64B-3026BD91C31E")> _
<InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)> _
Public Interface RibbonFactory
[GuidAttribute("1012BDD2-303F-4464-A64B-3026BD91C31E")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
public interface RibbonFactory

The RibbonFactory type exposes the following members.

Properties

  Name Description
Public property RibbonPosition Gets a RibbonPositionStatics object that you can use to specify the position of a control, group, or tab in a Ribbon customization.

Top

Methods

  Name Description
Public method _VtblGap1_19 Infrastructure.
Public method CreateOfficeRibbon Creates a OfficeRibbon object that represents a Ribbon customization.
Public method CreateRibbonBox Creates a RibbonBox object that arranges and aligns controls on a custom Ribbon.
Public method CreateRibbonButton A RibbonButton represents a button on a custom Ribbon.
Public method CreateRibbonButtonGroup Creates a RibbonButtonGroup object that represents a group of buttons on a Ribbon.
Public method CreateRibbonCheckBox Creates a RibbonCheckBox object that represents a check box on a Ribbon.
Public method CreateRibbonComboBox Creates a RibbonComboBox object that represents a combo box on a custom Ribbon.
Public method CreateRibbonDialogLauncher Creates a RibbonDialogLauncher object that represents a small standardized icon on a group that can be used to open a dialog box.
Public method CreateRibbonDropDown Creates a RibbonDropDown object that represents a list of items that a user can choose from and a list of Ribbon buttons that a user can click.
Public method CreateRibbonDropDownItem Creates a RibbonDropDownItem object that represents an item in a drop-down control.
Public method CreateRibbonEditBox Creates a RibbonEditBox object represents an edit box on a Ribbon.
Public method CreateRibbonGallery Creates a RibbonGallery object that represents a control that displays a menu of RibbonDropDownItem objects and RibbonButton controls.
Public method CreateRibbonGroup Creates a RibbonGroup that represents a group of controls on a Ribbon tab.
Public method CreateRibbonLabel Creates a RibbonLabel that represents a label on a RibbonGroup or RibbonBox.
Public method CreateRibbonManager Creates an IRibbonExtensibility object that represents a Ribbon customization.
Public method CreateRibbonMenu Creates a RibbonMenu that represents a menu on a Ribbon tab or on the Microsoft Office Menu.
Public method CreateRibbonReadOnlyCollection Creates a RibbonMenu object that provides access to the IRibbonExtension objects in a Ribbon customization.
Public method CreateRibbonSeparator Creates a RibbonSeparator object that represents a separator control for a group or menu on the Ribbon.
Public method CreateRibbonSplitButton Creates a RibbonSplitButton object that combines a button or a toggle button and a drop-down menu.
Public method CreateRibbonTab Creates a RibbonTab object that contains one or more groups of controls on the Ribbon.
Public method CreateRibbonToggleButton Creates a RibbonToggleButton that represents a toggle button control on a Ribbon.

Top

Remarks

Note

This interface is implemented by the Visual Studio Tools for Office runtime. It is not intended to be implemented in your code. For more information, see Visual Studio Tools for Office Runtime Overview.

Examples

The following example accesses the RibbonFactory instance of the project in the Ribbon code file of an Excel 2010 workbook project. This code uses methods in the RibbonFactory object to create a drop-down item, a menu, and a button. To view the complete sample, see Walkthrough: Updating the Controls on a Ribbon at Run Time.

Private Function CreateRibbonDropDownItem() As RibbonDropDownItem
    Return Me.Factory.CreateRibbonDropDownItem()
End Function 

Private Function CreateRibbonMenu() As RibbonMenu
    Return Me.Factory.CreateRibbonMenu()
End Function 

Private Function CreateRibbonButton() As RibbonButton
    Dim button As RibbonButton = Me.Factory.CreateRibbonButton()
    AddHandler (button.Click), AddressOf Button_Click
    Return button
End Function
private RibbonDropDownItem CreateRibbonDropDownItem()
{
    return this.Factory.CreateRibbonDropDownItem();
}
private RibbonMenu CreateRibbonMenu()
{
    return this.Factory.CreateRibbonMenu();
}
private RibbonButton CreateRibbonButton()
{
    RibbonButton button = this.Factory.CreateRibbonButton();
    button.Click += new RibbonControlEventHandler(button_Click);
    return button;
}

See Also

Reference

Microsoft.Office.Tools.Ribbon Namespace