本文為機器翻譯文章。如需檢視英文版,請選取 [原文] 核取方塊。您也可以將滑鼠指標移到文字上,即可在快顯視窗顯示英文原文。
譯文
原文

RibbonFactory.CreateRibbonMenu 方法 ()

 

建立 RibbonMenu 物件,這個物件表示功能區索引標籤或 Microsoft Office 功能表上的功能表。

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

RibbonMenu CreateRibbonMenu()

傳回值

Type: Microsoft.Office.Tools.Ribbon.RibbonMenu

功能區功能表。

下列範例會使用 CreateRibbonMenu 方法來建立新的功能表。

private void PopulateCustomerMenu()
{
    // Add two sub-menus to EmployeeMenu and populate each sub-menu
    // First sub-menu
    RibbonMenu subMenu1 = this.Factory.CreateRibbonMenu();
    subMenu1.Dynamic = true;
    subMenu1.Label = "A - M";
    subMenu1.Items.Add(this.Factory.CreateRibbonToggleButton());
    ((RibbonToggleButton)subMenu1.Items.Last()).Label = "Hall, Don";
    subMenu1.Items.Add(this.Factory.CreateRibbonToggleButton());
    ((RibbonToggleButton)subMenu1.Items.Last()).Label = "Valdez, Rachel";
    CustomerMenu.Items.Add(subMenu1);

    // Second sub-menu
    RibbonMenu subMenu2 = this.Factory.CreateRibbonMenu();
    subMenu2.Dynamic = true;
    subMenu2.Label = "N - Z";
    subMenu2.Items.Add(this.Factory.CreateRibbonToggleButton());
    ((RibbonToggleButton)subMenu2.Items.Last()).Label = "Robinson, Alex";
    CustomerMenu.Items.Add(subMenu2);
}
回到頁首
顯示: