示例#1
0
        public void AddItem(String strGroupName, String strItemName, Type type)
        {
            TypeResolutionService.AddType(type);

            if (DefaultIcon == null)
            {
                DefaultIcon = GetIcon(typeof(ABCControls.ABCGroupControl), false);
            }

            DevExpress.XtraNavBar.NavBarItem item = new DevExpress.XtraNavBar.NavBarItem();
            item.Caption = strItemName;
            item.Name    = strItemName;

            ABCToolboxItem toolboxItem = new ABCToolboxItem(type);

            toolboxItem.Binding           = new ABCControls.ABCBindingInfo();
            toolboxItem.Binding.FieldName = strItemName;
            item.Tag = toolboxItem;

            Bitmap icon = GetIcon(type, false);

            if (ImageCompareString(icon, DefaultIcon))
            {
                icon = GetIcon(type, true);
            }

            //    icon.Save( String.Format(@"Icons\{0}.png" , strItemName ));
            item.SmallImage = icon;
            this.navBarControl.Items.Add(item);
            this.navBarControl.Groups[strGroupName].ItemLinks.Add(item);

            HostSurfaceManager.CreateTemplateComponent(type);
        }