Esempio n. 1
0
        private void InitMenus(List <Menus> menus)
        {
            //1级菜单
            Dictionary <string, int> captionsText = new Dictionary <string, int>();

            foreach (var menu in menus.Where(p => p.ParentId == 0))
            {
                captionsText.Add(menu.MenuName, menu.Id);
            }
            NavBar navbar = new NavBar(captionsText);

            NaviContainer.Controls.Add(navbar);
            navbar.OnItemClick += Navbar_OnItemClick;
            navbar.InitNavBar();
            //2级菜单
            var groups = navbar.Groups;

            foreach (var icongroup in groups)
            {
                foreach (var menu in menus.Where(p => p.ParentId == icongroup.OrderId))
                {
                    icongroup.AddIcons(new IconButton(null, menu.MenuName, menu.MenuPath));
                }
            }
            navbar.Show();
        }
Esempio n. 2
0
        void CreateOutlook(ArrayList contents)
        {
            Outlook          = new NavBar(contents);
            Outlook.Dock     = System.Windows.Forms.DockStyle.Left;
            Outlook.Location = new System.Drawing.Point(0, 85);
            Outlook.Name     = "NavBar";
            Outlook.Size     = new System.Drawing.Size(160, 600);
            Outlook.TabIndex = 1;


            if (PadContentCollection.Count == 0)
            {
                return;
            }

            //    new ButtonGroup("欢迎使用")
            //    {
            //        ImageButtons = new List<ImageButton>()
            //        {
            //            new ImageButton("欢迎使用","Main",WinFormsResourceService.GetBitmap("NavBtnMain")),
            //            new ImageButton("联系人管理","ManageLinkMan",WinFormsResourceService.GetBitmap("NavBtnManageLinkMan"))
            //        }
            //    } ,

            var buttonGroup = new NavBar.ButtonGroup("欢迎使用");

            if (buttonGroup.ImageButtons == null)
            {
                buttonGroup.ImageButtons = new List <NavBar.ImageButton>();
            }
            foreach (PadDescriptor padDescriptor in contents)
            {
                buttonGroup.ImageButtons.Add(new NavBar.ImageButton(padDescriptor.Title, "", WinFormsResourceService.GetBitmap("NavBtnMain")));
            }
            Outlook.NavButtonGroup.Add(buttonGroup);
            Outlook.InitNavBar();
        }