/// <summary> /// 展开弹出项 /// </summary> public void ShowPopup() { if (this.IsOpened) { return; } // this.m_DropDownPopup.BaseItems.Clear(); Form form = this.TryGetDependParentForm(); if (form != null && form.IsMdiContainer && form.MdiChildren != null) { foreach (Form one in form.MdiChildren) { BaseButtonItem ribbonBaseButtonItem = new BaseButtonItem(); ribbonBaseButtonItem.Name = one.Name; ribbonBaseButtonItem.Text = one.Text; if (one.Icon != null) { ribbonBaseButtonItem.Image = one.Icon.ToBitmap(); } ribbonBaseButtonItem.Checked = one.ContainsFocus; ribbonBaseButtonItem.Tag = one; ribbonBaseButtonItem.MouseClick += new MouseEventHandler(BaseButtonItem_MouseClick); this.m_DropDownPopup.BaseItems.Add(ribbonBaseButtonItem); } } // this.m_DropDownPopup.Show(this.PopupLoction); }
public CustomizeButtonItem(IQuickAccessToolbarItem pQuickAccessToolbarItem) : base() { base.Name = "GISShare.Controls.WinForm.WFNew.CustomizeButtonItem"; base.Text = "自定义按钮"; base.UsingViewOverflow = false; // this.ShowNomalState = false; this.owner = pQuickAccessToolbarItem; ((ISetOwnerHelper)this).SetOwner(owner as IOwner); // this.SetPopupPadding(2, 2, 2, 2); //this.setr // LabelSeparatorItem ribbonLabelSeparatorItem = new LabelSeparatorItem(); ribbonLabelSeparatorItem.Name = GISShare.Controls.WinForm.WFNew.Language.LanguageStrategy.CustomizeTitleText; ribbonLabelSeparatorItem.Text = GISShare.Controls.WinForm.WFNew.Language.LanguageStrategy.CustomizeTitleText; ribbonLabelSeparatorItem.TextAlign = ContentAlignment.MiddleCenter; this.BaseItems.Add(ribbonLabelSeparatorItem); // this.m_TopOrBottomViewQuickAccessToolbar = new BaseButtonItem(); this.m_TopOrBottomViewQuickAccessToolbar.Name = GISShare.Controls.WinForm.WFNew.Language.LanguageStrategy.BottomViewQuickAccessToolbarText; this.m_TopOrBottomViewQuickAccessToolbar.Text = this.m_TopOrBottomViewQuickAccessToolbar.Name; this.m_TopOrBottomViewQuickAccessToolbar.MouseClick += new MouseEventHandler(TopOrBottomViewQuickAccessToolbar_MouseClick); this.BaseItems.Add(this.m_TopOrBottomViewQuickAccessToolbar); // this.m_DisplayOrHideRibbonPageContainer = new BaseButtonItem(); this.m_DisplayOrHideRibbonPageContainer.Name = GISShare.Controls.WinForm.WFNew.Language.LanguageStrategy.HideRibbonPageContainerText; this.m_DisplayOrHideRibbonPageContainer.Text = this.m_DisplayOrHideRibbonPageContainer.Name; this.m_DisplayOrHideRibbonPageContainer.MouseClick += new MouseEventHandler(DisplayOrHideRibbonPageContainer_MouseClick); this.BaseItems.Add(this.m_DisplayOrHideRibbonPageContainer); // this.BaseItems.Add(new SeparatorItem()); // this.m_CustomizeQuickAccessToolbar = new DropDownButtonItem(); this.m_CustomizeQuickAccessToolbar.Name = GISShare.Controls.WinForm.WFNew.Language.LanguageStrategy.CustomizeQuickAccessToolbarText; this.m_CustomizeQuickAccessToolbar.Text = GISShare.Controls.WinForm.WFNew.Language.LanguageStrategy.CustomizeQuickAccessToolbarText; this.m_CustomizeQuickAccessToolbar.eContextPopupStyle = ContextPopupStyle.eSuper; //IDropDownPopup pDropDownPopup = ((IPopupOwnerHelper)this.m_CustomizeQuickAccessToolbar).GetBasePopup() as IDropDownPopup; //if (pDropDownPopup != null) pDropDownPopup.eContextPopupStyle = ContextPopupStyle.eSuper; this.BaseItems.Add(this.m_CustomizeQuickAccessToolbar); ((ILockCollectionHelper)this.BaseItems).SetLocked(true); }
protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs mevent) { this.BaseItems.Clear(); foreach (BaseItem one in this.m_Owner.BaseItems) { BaseButtonItem item = new BaseButtonItem(); item.Name = one.Name; item.Text = one.Text; item.Tag = one; ITabButtonItem pTabButtonItem = one as ITabButtonItem; if (pTabButtonItem != null) { item.Image = pTabButtonItem.Image; item.Checked = pTabButtonItem.IsSelected; } item.MouseClick += new System.Windows.Forms.MouseEventHandler(Item_MouseClick); this.BaseItems.Add(item); } // base.OnMouseDown(mevent); }
void Item_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e) { BaseButtonItem item = sender as BaseButtonItem; if (item == null) { return; } ITabButtonItem pTabButtonItem = item.Tag as ITabButtonItem; if (pTabButtonItem == null) { return; } pTabButtonItem.Selected(); if (this.m_Owner.AutoShowOverflowTabButton && pTabButtonItem.Overflow) { IBaseItem5 pBaseItem5 = pTabButtonItem as IBaseItem5; if (pBaseItem5 != null) { pBaseItem5.MoveTo(0); } } }
public override object Clone() { BaseButtonItem baseItem = new BaseButtonItem(); baseItem.Checked = this.Checked; baseItem.Enabled = this.Enabled; baseItem.Font = this.Font; baseItem.ForeColor = this.ForeColor; baseItem.Name = this.Name; baseItem.Site = this.Site; baseItem.Size = this.Size; baseItem.Tag = this.Tag; baseItem.Text = this.Text; baseItem.eDisplayStyle = this.eDisplayStyle; baseItem.eImageSizeStyle = this.eImageSizeStyle; baseItem.Image = this.Image; baseItem.ImageAlign = this.ImageAlign; baseItem.ImageSize = this.ImageSize; baseItem.LeftBottomRadius = this.LeftBottomRadius; baseItem.LeftTopRadius = this.LeftTopRadius; baseItem.Padding = this.Padding; baseItem.RightBottomRadius = this.RightBottomRadius; baseItem.RightTopRadius = this.RightTopRadius; baseItem.ShowNomalState = this.ShowNomalState; baseItem.TextAlign = this.TextAlign; baseItem.TextLeftSpace = this.TextLeftSpace; baseItem.TextRightSpace = this.TextRightSpace; baseItem.Visible = this.Visible; if (this.GetEventState("VisibleChanged") == EventStateStyle.eUsed) { baseItem.VisibleChanged += new EventHandler(baseItem_VisibleChanged); } if (this.GetEventState("SizeChanged") == EventStateStyle.eUsed) { baseItem.SizeChanged += new EventHandler(baseItem_SizeChanged); } if (this.GetEventState("Paint") == EventStateStyle.eUsed) { baseItem.Paint += new PaintEventHandler(baseItem_Paint); } if (this.GetEventState("MouseUp") == EventStateStyle.eUsed) { baseItem.MouseUp += new MouseEventHandler(baseItem_MouseUp); } if (this.GetEventState("MouseMove") == EventStateStyle.eUsed) { baseItem.MouseMove += new MouseEventHandler(baseItem_MouseMove); } if (this.GetEventState("MouseLeave") == EventStateStyle.eUsed) { baseItem.MouseLeave += new EventHandler(baseItem_MouseLeave); } if (this.GetEventState("MouseEnter") == EventStateStyle.eUsed) { baseItem.MouseEnter += new EventHandler(baseItem_MouseEnter); } if (this.GetEventState("MouseDown") == EventStateStyle.eUsed) { baseItem.MouseDown += new MouseEventHandler(baseItem_MouseDown); } if (this.GetEventState("MouseDoubleClick") == EventStateStyle.eUsed) { baseItem.MouseDoubleClick += new MouseEventHandler(baseItem_MouseDoubleClick); } if (this.GetEventState("MouseClick") == EventStateStyle.eUsed) { baseItem.MouseClick += new MouseEventHandler(baseItem_MouseClick); } if (this.GetEventState("LocationChanged") == EventStateStyle.eUsed) { baseItem.LocationChanged += new EventHandler(baseItem_LocationChanged); } if (this.GetEventState("EnabledChanged") == EventStateStyle.eUsed) { baseItem.EnabledChanged += new EventHandler(baseItem_EnabledChanged); } if (this.GetEventState("CheckedChanged") == EventStateStyle.eUsed) { baseItem.CheckedChanged += new EventHandler(baseItem_CheckedChanged); } return(baseItem); }