• dev 的NavBarControl动态菜单


     private void InitMunu()
            {
                navBarControl.Items.Clear();
                navBarControl.Groups.Clear();
                navBarControl.SmallImages = this.imageTool;//dev  自带图标才会有用
                var data = CreateMunu();
                int i = 0;
                foreach (var nbg in data.Where(it => it.PID == -1))
                {
                    NavBarGroup navBarGroup1 = new NavBarGroup();
                    navBarGroup1.Appearance.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                    navBarGroup1.Appearance.Options.UseFont = true;
                    navBarGroup1.TopVisibleLinkIndex = i;
                    navBarGroup1.Caption = nbg.FunctionName;
                    //navBarGroup1.Name = "客户管理";
                    navBarGroup1.SmallImageIndex = nbg.SmallImageIndex;
                    if (i == 0)
                        navBarGroup1.Expanded = true;
                    foreach (var nbi in data.Where(it => it.PID == nbg.ID))
                    {
                        NavBarItem Item = new NavBarItem();
                        Item.Appearance.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                        Item.Caption = nbi.FunctionName;
                        //Item.Name = "区本管理Item";
                        Item.SmallImageIndex = nbi.SmallImageIndex;//图标下标
                        Item.Tag = nbi.FunctionKey;
                        Item.Appearance.Options.UseFont = true;
                        Item.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(Item_LinkClicked);
                        navBarGroup1.ItemLinks.Add(Item);//
                        navBarControl.Items.Add(Item);//dev 自带图标才会生效
                    }
                    navBarControl.Groups.Add(navBarGroup1);
                    i++;
                }
            }
            //事件
            private void Item_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
            {
                NavBarItem Item = (NavBarItem)sender;
                if (!string.IsNullOrEmpty(Item.Tag.ToString()))
                {
                    var typeFullNames = Item.Tag.ToString().Split(',');
                    foreach (var typeFullName in typeFullNames)
                    {
                        var type = GetFrom(typeFullName);//反射窗体类型
                        if (type != null)
                        {
                            type.Text = Item.Caption;
                            ShowMdiForm(type);
                        }
                    }
                }
            }
  • 相关阅读:
    hadoop配置文件说明
    hadoop集群部署
    Linux iptables防火墙实用模板
    不容忽视的SQL注入式攻击
    字符串的加解密
    .NET程序集版本号的奥秘
    SQL Server 2005 数据库引擎的容量规范
    Microsoft Visual Studio Tools for the Microsoft Office system(3.0 版)
    How to: Display a Dialog Box for Selecting Entries from the Contacts Folder
    OpenID及其原理介绍
  • 原文地址:https://www.cnblogs.com/shuaimeng/p/15492004.html
Copyright © 2020-2023  润新知