コード例 #1
0
        //加载模块功能
        private void LoadModuleFunction(NavBarGroup CurrentGroup, BarSubItem CurrentBarItem, ModuleFunction fun)
        {
            if (CurrentGroup != null)
            {
                //添加功能到navBarControl1
                NavBarItem item = navBarControl1.Items.Add();
                item.Caption = fun.Caption;
                item.Tag     = fun.FunctionID;
                //item.SmallImage = FunSmallImage;
                //item.SmallImage = imageList1.Images["Forward"];
                item.SmallImage = Common.ImageLibrary.ResizeImage(fun.FormIcon, 16, 16);
                //item.SmallImage = Common.ImageLibrary.ResizeImage(fun.LoadFormEx().Icon.ToBitmap(), 16, 16);

                item.LinkClicked += item_LinkClicked;

                CurrentGroup.ItemLinks.Insert(0, item);

                if (fun.IsNew)
                {
                    item.Appearance.ForeColor = Color.FromArgb(0x99, 0x00, 0x33);
                    item.Appearance.Font      = new Font(CurrentGroup.Appearance.Font, FontStyle.Bold);
                }
            }
            if (CurrentBarItem != null)
            {
                //添加功能到bbi_Module
                var bbif = new DevExpress.XtraBars.BarButtonItem()
                {
                    Caption = fun.Caption,
                    Tag     = fun.FunctionID,
                    //Glyph = FunSmallImage
                    Glyph = imageList1.Images["Forward"]
                };
                //if (fun.IsNew)
                //{
                //    item.Appearance.ForeColor = Color.FromArgb(0x99, 0x00, 0x33);
                //    item.Appearance.Font = new Font(CurrentGroup.Appearance.Font, FontStyle.Bold);
                //}

                bbif.ItemClick += bbi_ItemClick;
                this.ribbonControl1.Items.Add(bbif);
                if (CurrentBarItem.ItemLinks.Count > 0)
                {
                    CurrentBarItem.InsertItem(CurrentBarItem.ItemLinks[0], bbif);
                }
                else
                {
                    CurrentBarItem.AddItem(bbif);
                }
            }
        }