public UCMenuBarDesign()
        {
            this.InitializeComponent();
            this.radTreeView1.SelectedNodeChanged += new RadTreeView.RadTreeViewEventHandler(this.radTreeView1_SelectedNodeChanged);
            this.radTreeView1.ItemHeight           = 40;
            this.groupitems           = GroupItems.UnSerializeFromXML(SystemHelper.GetAssemblesDirectory() + "toolitems.xml");
            this.radTreeView1.Visible = true;
            RadTreeNode radTreeNode = this.radTreeView1.Nodes.Add("顶部工具栏");

            radTreeNode.Tag = this.groupitems.TopBarItems;
            foreach (GroupItem current in this.groupitems.TopBarItems)
            {
                RadTreeNode radTreeNode2 = radTreeNode.Nodes.Add(current.name);
                radTreeNode2.Tag = current;
                foreach (ToolItem current2 in current.ToolItems)
                {
                    RadTreeNode radTreeNode3 = radTreeNode2.Nodes.Add(current2.name);
                    radTreeNode3.Tag = current2;
                }
            }
            RadTreeNode radTreeNode4 = this.radTreeView1.Nodes.Add("右边工具栏");

            foreach (GroupItem current3 in this.groupitems.RightPaneItems)
            {
                RadTreeNode radTreeNode5 = radTreeNode4.Nodes.Add(current3.name);
                radTreeNode5.Tag = current3;
                foreach (ToolItem current4 in current3.ToolItems)
                {
                    RadTreeNode radTreeNode6 = radTreeNode5.Nodes.Add(current4.name);
                    radTreeNode6.Tag = current4;
                }
            }
        }
        private void InitToolItems()
        {
            string designDirectory;

            if (base.DesignMode)
            {
                designDirectory = SystemHelper.GetDesignDirectory();
            }
            else
            {
                designDirectory = SystemHelper.GetAssemblesDirectory();
            }
            GroupItems items = GroupItems.UnSerializeFromXML(designDirectory + "toolitems.xml");

            if (items != null)
            {
                this.InitializeChild(items.RightPaneItems);
            }
        }
示例#3
0
        public void InitializeChild()
        {
            bool   designMode = base.DesignMode;
            string str;

            if (designMode)
            {
                str = SystemHelper.GetDesignDirectory();
            }
            else
            {
                str = SystemHelper.GetAssemblesDirectory();
            }
            GroupItems groupItems = GroupItems.UnSerializeFromXML(str + "toolitems.xml");
            bool       flag       = groupItems == null;

            if (!flag)
            {
                List <GroupItem> topBarItems = groupItems.TopBarItems;
                bool             flag2       = topBarItems == null;
                if (!flag2)
                {
                    List <ToolItem> toolItems = topBarItems[0].ToolItems;
                    this._bubbleBar1      = new BubbleBar();
                    this._bubbleBar1.Name = "bubbleBar1";
                    ((ISupportInitialize)this._bubbleBar1).BeginInit();
                    this._bubbleBar1.ForeColor            = Color.Green;
                    this._bubbleBar1.BackColor            = Color.Transparent;
                    this._bubbleBar1.Element.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;
                    this._bubbleBar1.Dock = DockStyle.Fill;
                    foreach (ToolItem current in toolItems)
                    {
                        bool flag3 = !current.visable;
                        if (!flag3)
                        {
                            RadButtonElement radButtonElement = new RadButtonElement();
                            radButtonElement.CanFocus = true;
                            string text  = SystemHelper.ResourceDir + current.image;
                            bool   flag4 = File.Exists(text);
                            if (flag4)
                            {
                                radButtonElement.Image = DocScanner.ImgUtils.ImageHelper.LoadSizedImage(text, UISetting.GetInstance().ButtonSize, UISetting.GetInstance().ButtonSize, "");
                            }
                            radButtonElement.Name           = current.name;
                            radButtonElement.Padding        = new Padding(2, 2, 2, 8);
                            radButtonElement.ScaleTransform = new SizeF(0.65f, 0.65f);
                            radButtonElement.ShowBorder     = false;
                            radButtonElement.ToolTipText    = current.tip;
                            radButtonElement.Text           = (UISetting.GetInstance().ShowButtonText ? current.text : "");
                            radButtonElement.TextAlignment  = ContentAlignment.BottomCenter;
                            radButtonElement.Tag            = current.action;
                            radButtonElement.MouseDown     += new MouseEventHandler(this.radButtonElement_MouseDown);
                            ((FillPrimitive)radButtonElement.GetChildAt(0)).Visibility = ElementVisibility.Hidden;
                            this._bubbleBar1.Items.Add(radButtonElement);
                        }
                    }
                    string barBackImage = UISetting.GetInstance().BarBackImage;
                    bool   flag5        = File.Exists(barBackImage);
                    if (flag5)
                    {
                        this._bubbleBar1.BackgroundImage = DocScanner.ImgUtils.ImageHelper.LoadLocalImage(barBackImage, true);
                    }
                    else
                    {
                        this._bubbleBar1.Element.FillWithColor(UISetting.GetInstance().BarBackColor);
                    }
                    ((ISupportInitialize)this._bubbleBar1).EndInit();
                    base.Controls.Add(this._bubbleBar1);
                }
            }
        }