Ejemplo n.º 1
0
        private void UnloadPopup(object sender, System.EventArgs e)
        {
            ButtonItem item = sender as ButtonItem;

            if (item.Name == "bTextColor")
            {
                DevComponents.DotNetBar.PopupContainerControl container = item.PopupContainerControl as PopupContainerControl;
                ColorPicker clr = container.Controls[0] as ColorPicker;
                if (clr.SelectedColor != Color.Empty)
                {
                    frmDocument activedocument = this.ActiveMdiChild as frmDocument;
                    if (activedocument != null)
                    {
                        activedocument.ExecuteCommand(item.Name, clr.SelectedColor);
                    }
                }
            }
            else if (item.Name == "bTabColor")
            {
                DevComponents.DotNetBar.PopupContainerControl container = item.PopupContainerControl as PopupContainerControl;
                ColorPicker clr = container.Controls[0] as ColorPicker;
                if (clr.SelectedColor != Color.Empty)
                {
                    tabStrip1.ColorScheme.TabBackground  = ControlPaint.LightLight(clr.SelectedColor);
                    tabStrip1.ColorScheme.TabBackground2 = clr.SelectedColor;
                    tabStrip1.Refresh();
                }
                // Close popup menu, since it is not closed when Popup Container is closed...
                item.Parent.Expanded = false;
            }
        }
Ejemplo n.º 2
0
        private void LoadPopup(object sender, System.EventArgs e)
        {
            ButtonItem item = sender as ButtonItem;

            if (item == bTabColor)
            {
                DevComponents.DotNetBar.PopupContainerControl container = item.PopupContainerControl as PopupContainerControl;
                ColorPicker clr = new ColorPicker();
                container.Controls.Add(clr);
                if (cmdStyleOffice2003.Checked)
                {
                    clr.BackColor       = dotNetBarManager1.Bars[0].ColorScheme.BarBackground2;
                    clr.tabStrip1.Style = eTabStripStyle.Office2003;
                }
                clr.Location         = container.ClientRectangle.Location;
                container.ClientSize = clr.Size;
            }
        }
Ejemplo n.º 3
0
        private void ColorSelected()
        {
            DevComponents.DotNetBar.PopupContainerControl ctrl = this.Parent as DevComponents.DotNetBar.PopupContainerControl;
            if (ctrl == null)
            {
                return;
            }

            // Change the Parent Item image to indicate which color was selected last
            // Assumes that Image with ImageIndex 21 is used on button
            DevComponents.DotNetBar.ButtonItem btn = ctrl.ParentItem as DevComponents.DotNetBar.ButtonItem;
            Bitmap   bmp = new Bitmap(btn.Image);
            Graphics g   = Graphics.FromImage(bmp);

            g.DrawImageUnscaled(btn.Image, 0, 0);
            using (SolidBrush brush = new SolidBrush(this.SelectedColor))
                g.FillRectangle(brush, 0, 12, 16, 4);
            g.Dispose();
            btn.ImageIndex = -1;
            DevComponents.DotNetBar.DotNetBarManager manager = null;
            if (btn.ContainerControl is DevComponents.DotNetBar.Bar)
            {
                manager = ((DevComponents.DotNetBar.Bar)btn.ContainerControl).Owner as DevComponents.DotNetBar.DotNetBarManager;
            }
            else if (btn.ContainerControl is DevComponents.DotNetBar.MenuPanel)
            {
                manager = ((DevComponents.DotNetBar.MenuPanel)btn.ContainerControl).Owner as DevComponents.DotNetBar.DotNetBarManager;
            }
            if (manager != null && btn.Name != "")
            {
                ArrayList items = manager.GetItems(btn.Name, true);
                foreach (DevComponents.DotNetBar.ButtonItem item in items)
                {
                    item.Image = bmp;
                }
            }
            else
            {
                btn.Image = bmp;
            }

            if (btn.ContainerControl is RibbonBar)
            {
                ((RibbonBar)btn.ContainerControl).RecalcLayout();
            }

            if (btn.IsOnMenu)
            {
                DevComponents.DotNetBar.BaseItem topItem = ctrl.ParentItem;
                while (topItem.Parent is DevComponents.DotNetBar.ButtonItem)
                {
                    topItem = topItem.Parent;
                }
                topItem.Expanded = false;
                if (topItem.Parent != null)
                {
                    topItem.Parent.AutoExpand = false;
                }
            }
            else
            {
                btn.Expanded = false;
            }
        }
Ejemplo n.º 4
0
		/// <summary>
		/// Closes the currently open popup.
		/// </summary>
		public virtual void ClosePopup()
		{
			if(m_OldSubItemsImageSize!=Size.Empty)
			{
				this.SubItemsImageSize=m_OldSubItemsImageSize;
				m_OldSubItemsImageSize=Size.Empty;
			}

			//DotNetBarManager owner=this.GetOwner();
			IOwnerMenuSupport ownerMenu=this.GetIOwnerMenuSupport();

			if(ownerMenu!=null)
				ownerMenu.UnregisterPopup(this);
			m_FilterInstalled=false;

			// Fire off events
			if(m_PopupContainer!=null)
			{
				if(PopupContainerUnload!=null)
					PopupContainerUnload(this,new EventArgs());
				
				if(ownerMenu!=null)
					ownerMenu.InvokePopupContainerUnload(this,new EventArgs());
			}

			if((m_PopupBar!=null || m_PopupMenu!=null || m_PopupContainer!=null) && ownerMenu!=null)
			{
                OnPopupClose(EventArgs.Empty);
			}

			if(m_PopupMenu!=null)
			{
                if (this.ContainerControl is IKeyTipsControl)
                {
                    IKeyTipsControl kc = this.ContainerControl as IKeyTipsControl;
                    kc.ShowKeyTips = m_PopupMenu.ShowKeyTips;
                    m_PopupMenu.ShowKeyTips = false;
                }
                m_PopupMenu.Close();
				m_PopupMenu.Dispose();
				m_PopupMenu=null;
			}
			if(m_PopupBar!=null)
			{
				m_PopupBar.Hide();
				m_PopupBar.Dispose();
				m_PopupBar=null;
			}
			if(m_PopupContainer!=null)
			{
				m_PopupContainer.Hide();
				m_PopupContainer.Dispose();
				m_PopupContainer=null;
			}
			this.Expanded=false;

			IOwner owner=this.GetOwner() as IOwner;
			if(owner!=null && owner.ParentForm!=null)
			{
				owner.ParentForm.Update();
			}

            OnPopupFinalized(EventArgs.Empty);
		}
Ejemplo n.º 5
0
        /// <summary>
        /// Creates the popup container control which is a parent/holder control for the controls you want to display on the popup.
        /// This method can be used if you do not wish to handle the PopupContainerLoad to add controls to the popup container.
        /// After calling this method you can access PopupContainerControl property to add your controls to be displayed on the popup.
        /// </summary>
        /// <param name="fireLoadEvents">Indicates whether PopupContainerLoad events are fired.</param>
        public virtual void CreatePopupContainer(bool fireLoadEvents)
        {
            if (this.PopupType != ePopupType.Container)
                throw new InvalidOperationException("Method can only be called for PopupType set to ePopupType.Container");

            if (m_PopupContainer == null)
            {
                m_PopupContainer = new PopupContainerControl();
                m_PopupContainer.Owner = this.GetOwner();
                m_PopupContainer.ParentItem = this;
                m_PopupContainer.CreateControl();
                m_PopupContainer.SetDesignMode(this.DesignMode);
                m_PopupContainer.Width = m_PopupWidth;

                if (fireLoadEvents)
                {
                    IOwnerMenuSupport ownerMenu = this.GetIOwnerMenuSupport();
                    // Fire off events
                    if (PopupContainerLoad != null)
                        PopupContainerLoad(this, new EventArgs());
                    if (ownerMenu != null)
                        ownerMenu.InvokePopupContainerLoad(this, new EventArgs());

                    // Recalc Size would go here...
                    m_PopupContainer.RecalcSize();
                }
            }
        }