Beispiel #1
0
        /// <summary>
        /// 添加菜单页
        /// </summary>
        private void addMenusPages(IEnumerable <WinformMenu> allMenus, RibbonControl menuContainer)
        {
            var orderSettings = GetMenuOrderSettings();
            var pages         = allMenus.Where(m => m.IsPage).ToList();

            if (pages.Count > 0)
            {
                IList <WinformMenu> pageMenus = getOrderedMenus(pages, orderSettings);
                foreach (WinformMenu pageMenu in pageMenus)
                {
                    RibbonPage ribbonPage = new RibbonPage {
                        Text  = pageMenu.DisplayName,
                        Image = pageMenu.Icon,
                        Name  = pageMenu.Name
                    };
                    addMenusGroups(pageMenu, ribbonPage, orderSettings);
                    menuContainer.Pages.Add(ribbonPage);
                }
                menuContainer.SelectPage(menuContainer.Pages[0]);
            }
        }
 public override void OnRibbonMerged(RibbonControl ownerRibbon)
 {
     base.OnRibbonMerged(ownerRibbon);
     ownerRibbon.SelectPage(this.ribbonControl1.Pages[0]);
 }