Share via


RibbonFactory 介面

提供您可以用來為 Microsoft Office 功能區自訂建立功能區控制項的方法。

命名空間:  Microsoft.Office.Tools.Ribbon
組件:   Microsoft.Office.Tools.Common.v4.0.Utilities (在 Microsoft.Office.Tools.Common.v4.0.Utilities.dll 中)
  Microsoft.Office.Tools.Common (在 Microsoft.Office.Tools.Common.dll 中)

語法

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

RibbonFactory 型別會公開下列成員。

屬性

  名稱 說明
公用屬性 RibbonPosition 取得 RibbonPositionStatics 物件,您可以使用這個物件,在功能區自訂中指定控制項、群組或索引標籤的位置。

回頁首

方法

  名稱 說明
公用方法 _VtblGap1_19
公用方法 CreateOfficeRibbon 建立表示功能區自訂的 OfficeRibbon 物件。
公用方法 CreateRibbonBox 建立 RibbonBox 物件,這個物件會排列和對齊自訂功能區上的控制項。
公用方法 CreateRibbonButton RibbonButton ,表示自訂功能區上的按鈕。
公用方法 CreateRibbonButtonGroup 建立 RibbonButtonGroup 物件,這個物件表示在功能區上的按鈕群組。
公用方法 CreateRibbonCheckBox 建立 RibbonCheckBox 物件,這個物件表示功能區上的核取方塊。
公用方法 CreateRibbonComboBox 建立 RibbonComboBox 物件,這個物件表示自訂功能區上的下拉式方塊。
公用方法 CreateRibbonDialogLauncher 建立 RibbonDialogLauncher 物件,這個物件表示群組中可用來開啟對話方塊的小型標準化圖示。
公用方法 CreateRibbonDropDown 建立 RibbonDropDown 物件,這個物件表示使用者可從中選擇項目的清單,以及使用者可按一下之功能區按鈕的清單。
公用方法 CreateRibbonDropDownItem 建立 RibbonDropDownItem 物件,這個物件表示下拉式控制項中的項目。
公用方法 CreateRibbonEditBox 建立 RibbonEditBox 物件,這個物件表示功能區上的編輯方塊。
公用方法 CreateRibbonGallery 建立 RibbonGallery 物件,這個物件表示顯示 RibbonDropDownItem 物件和 RibbonButton 控制項之功能表的控制項。
公用方法 CreateRibbonGroup 建立 RibbonGroup 物件,這個物件表示在功能區索引標籤上的控制項群組。
公用方法 CreateRibbonLabel 建立 RibbonLabel 物件,這個物件表示 RibbonGroupRibbonBox 上的標籤。
公用方法 CreateRibbonManager 建立表示功能區自訂的 IRibbonExtensibility 物件。
公用方法 CreateRibbonMenu 建立 RibbonMenu 物件,這個物件表示功能區索引標籤或 Microsoft Office 功能表上的功能表。
公用方法 CreateRibbonReadOnlyCollection 建立 RibbonMenu 物件,這個物件可讓您存取功能區自訂中的 IRibbonExtension 物件。
公用方法 CreateRibbonSeparator 建立 RibbonSeparator 物件,這個物件表示功能區上之群組或功能表的分隔符號控制項。
公用方法 CreateRibbonSplitButton 建立 RibbonSplitButton 物件,這個物件結合了按鈕或切換按鈕與下拉式功能表。
公用方法 CreateRibbonTab 建立 RibbonTab 物件,這個物件包含功能區上的一個或多個控制項群組。
公用方法 CreateRibbonToggleButton 建立 RibbonToggleButton 物件,這個物件表示功能區索引標籤上的切換按鈕控制項。

回頁首

備註

注意事項注意事項

這個界面是由 Visual Studio Tools for Office Runtime 實作,並不能實作於您的程式碼中。如需詳細資訊,請參閱 Visual Studio Tools for Office Runtime 概觀

範例

下列範例會存取 Excel 2010 活頁簿專案之功能區程式碼檔案中專案的 RibbonFactory 執行個體。 這個程式碼會使用 RibbonFactory 物件中的方法來建立下拉式項目、功能表和按鈕。 若要檢視完整的範例,請參閱逐步解說:在執行階段更新功能區中的控制項


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;
}

請參閱

參考

Microsoft.Office.Tools.Ribbon 命名空間