/// <summary>
        /// 添加Page页面的Group分组
        /// </summary>
        /// <param name="rbpage"></param>
        /// <param name="sParentNode"></param>
        void AddRibbonGroup(RibbonPage rbpage, string sParentNode)
        {
            string _sNode;
            //获得当前登录用户权限表
            DataView _GroupView = new DataView(SystemAuthentication.UserAuthorities);
            //用于判断Group是否存在子项
            DataView _NodeView = new DataView(SystemAuthentication.UserAuthorities);

            //按照菜单排序进行重新排序
            _GroupView.Sort = "MenuOrder ASC";
            //获取Group菜单
            _GroupView.RowFilter = "MenuLevel = 2 AND  ParentMenuID='" + sParentNode + "'";

            foreach (DataRowView drv in _GroupView)
            {
                _sNode = drv.Row["MenuID"].ToString();
                _NodeView.RowFilter = "MenuLevel = 3 AND ParentMenuID ='" + _sNode + "'";
                //如果存在子项,则添加Group 不存在不添加
                if (_NodeView.Count > 0)
                {
                    RibbonPageGroup addgp = new RibbonPageGroup();
                    //菜单显示名称
                    addgp.Text              = drv.Row["MenuText"].ToString();
                    addgp.Tag               = drv.Row["MenuNewID"].ToString();
                    addgp.Name              = drv.Row["MenuName"].ToString();
                    addgp.MergeOrder        = Convertto.ToInt(drv.Row["MenuOrder"]);
                    addgp.ShowCaptionButton = false;
                    AddRibbonItem(addgp, drv.Row["MenuID"].ToString());
                    rbpage.Groups.Add(addgp);
                }
            }
            //AddNavItem(addgp, drv.Row["MenuID"].ToString());
        }
        /// <summary>
        /// 添加分组的ButtonItem按钮
        /// </summary>
        /// <param name="rbGroup"></param>
        /// <param name="sParentNode"></param>
        void AddRibbonItem(RibbonPageGroup rbGroup, string sParentNode)
        {
            //获得当前登录用户权限表
            DataView _GroupView = new DataView(SystemAuthentication.UserAuthorities);

            //按照菜单排序进行重新排序
            _GroupView.Sort = "MenuOrder ASC";
            //获取Group菜单
            _GroupView.RowFilter = "MenuLevel = 3 AND  ParentMenuID='" + sParentNode + "'";

            //操作提示注册
            DevExpress.Utils.SuperToolTip     PageToolTip  = new DevExpress.Utils.SuperToolTip();
            DevExpress.Utils.ToolTipTitleItem TitleToolTip = new DevExpress.Utils.ToolTipTitleItem();
            DevExpress.Utils.ToolTipItem      ItemToolTip  = new DevExpress.Utils.ToolTipItem();
            TitleToolTip.Text = "操作提示";
            foreach (DataRowView drv in _GroupView)
            {
                BarButtonItem AddBtnItem = new BarButtonItem();
                //菜单显示名称
                AddBtnItem.Caption    = drv.Row["MenuText"].ToString();
                AddBtnItem.Tag        = drv.Row["MenuNewID"].ToString();
                AddBtnItem.Name       = drv.Row["MenuName"].ToString();
                AddBtnItem.MergeOrder = Convertto.ToInt(drv.Row["MenuOrder"]);
                AddBtnItem.LargeGlyph = Globals.LoadImage(drv.Row["MenuIcon"].ToString(), 32);
                ItemToolTip.Text      = drv.Row["MenuTips"].ToString();
                PageToolTip.Items.Clear();
                PageToolTip.Items.Add(TitleToolTip);
                PageToolTip.Items.Add(ItemToolTip);
                AddBtnItem.SuperTip = PageToolTip;
                rbGroup.ItemLinks.Add(AddBtnItem);
                AddBtnItem.ItemClick += new ItemClickEventHandler(AddBtnItem_ItemClick);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 修改每页显示离开焦点触发
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnPageCount_Leave(object sender, EventArgs e)
        {
            int num = 0;

            num = Convertto.ToInt(OnPageCount.Text);
            if (num == PageSize)
            {
                return;
            }
            pageSize = num;
            btnFirstPage_Click(sender, e);
        }
        /// <summary>
        /// 添加Ribbon的Page页面
        /// </summary>
        /// <param name="MainControl"></param>
        void AddRibbonPage(RibbonControl MainControl)
        {
            MainControl.SuspendLayout();
            //获得当前登录用户权限表
            DataView _PageView = new DataView(SystemAuthentication.UserAuthorities);

            //按照菜单排序进行重新排序
            _PageView.Sort = "MenuOrder DESC";
            //获取Page菜单
            _PageView.RowFilter = "MenuLevel = 1";
            foreach (DataRowView drv in _PageView)
            {
                RibbonPage addgp = new RibbonPage();
                //菜单显示名称
                addgp.Text       = drv.Row["MenuText"].ToString();
                addgp.Tag        = drv.Row["MenuNewID"].ToString();
                addgp.Name       = drv.Row["MenuName"].ToString();
                addgp.Image      = Globals.LoadImage(drv.Row["MenuIcon"].ToString(), 16);
                addgp.MergeOrder = Convertto.ToInt(drv.Row["MenuOrder"]);
                //添加分组
                AddRibbonGroup(addgp, drv.Row["MenuID"].ToString());
                //page添加在第一个后面进行倒叙插入
                MainControl.Pages.Insert(1, addgp);

                LogNHelper.Info(addgp.Text);
                LogNHelper.Info(drv.Row["MenuNewID"].ToString());
                LogNHelper.Info(addgp.Name);
                LogNHelper.Info(drv.Row["MenuIcon"].ToString());
                // LogNHelper.Info(drv.Row["MenuTips"].ToString());
                LogNHelper.Info(drv.Row["MenuID"].ToString());
                LogNHelper.Info("-------");
            }


            MainControl.ResumeLayout();
        }