Beispiel #1
0
 private void UCTopMenuBubbleBar_MouseClick(object sender, MouseEventArgs e)
 {
     if (AppSetting.GetInstance().ShowAdvanceSetting)
     {
         if (e.Button == MouseButtons.Right)
         {
             ContextMenu contextMenu = new ContextMenu();
             MenuItem    menuItem    = new MenuItem();
             menuItem.Text   = "刷新";
             menuItem.Click += delegate(object newsender, EventArgs newe)
             {
                 base.SuspendLayout();
                 bool flag3 = this._bubbleBar1 != null;
                 if (flag3)
                 {
                     this._bubbleBar1.Items.Clear();
                     base.Controls.Remove(this._bubbleBar1);
                     this._bubbleBar1.Dispose();
                     this._bubbleBar1 = null;
                 }
                 this.InitializeChild();
                 base.ResumeLayout();
                 this.Refresh();
             };
             contextMenu.MenuItems.Add(menuItem);
             contextMenu.Show(this, e.Location);
         }
     }
 }
Beispiel #2
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);
                }
            }
        }