当前位置: 首页>>代码示例>>C#>>正文


C# ButtonItem.Dispose方法代码示例

本文整理汇总了C#中DevComponents.DotNetBar.ButtonItem.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# ButtonItem.Dispose方法的具体用法?C# ButtonItem.Dispose怎么用?C# ButtonItem.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DevComponents.DotNetBar.ButtonItem的用法示例。


在下文中一共展示了ButtonItem.Dispose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowCustomizeContextMenu

        /// <summary>
        /// Displays popup customize context menu for given customization object.
        /// </summary>
        /// <param name="o">Object that should be customized, usually an instance of BaseItem.</param>
        /// <param name="ribbonStrip">Indicates whether customize menu is displayed over ribbon strip</param>
        internal virtual void ShowCustomizeContextMenu(object o, bool ribbonStrip)
        {
            if (o == null || !m_UseCustomizeDialog)
                return;

            m_RibbonStrip.ClosePopup(SYS_CUSTOMIZE_POPUP_MENU);

            ButtonItem cont = new ButtonItem(SYS_CUSTOMIZE_POPUP_MENU);
            cont.Style = eDotNetBarStyle.Office2007;
            cont.SetOwner(m_RibbonStrip);

            if ((CanCustomizeItem(o as BaseItem) || o is RibbonBar) && !m_UseExternalCustomization)
            {
                if (o is BaseItem && this.QuickToolbarItems.Contains((BaseItem)o))
                {

                    ButtonItem b = new ButtonItem(SysQatRemoveFromItemName);
                    b.Text = this.SystemText.QatRemoveItemText;
                    b.Click += new System.EventHandler(CustomizeRemoveFromQuickAccessToolbar);
                    b.Tag = o;
                    cont.SubItems.Add(b);
                }
                else
                {
                    BaseItem itemToCustomize = o as BaseItem;

                    ButtonItem b = new ButtonItem(SysQatAddToItemName);
                    b.Text = this.SystemText.QatAddItemText;
                    b.Click += new System.EventHandler(CustomizeAddToQuickAccessToolbar);
                    b.Tag = o;
                    cont.SubItems.Add(b);

                    if (itemToCustomize != null && this.QuickToolbarItems.Contains(itemToCustomize.Name) ||
                        o is RibbonBar && this.QuickToolbarItems.Contains(GetQATRibbonBarName(o as RibbonBar)))
                        b.Enabled = false;

                    if (itemToCustomize != null && BaseItem.IsOnPopup(itemToCustomize) && itemToCustomize.Parent != null)
                    {
                        Control c = itemToCustomize.ContainerControl as Control;
                        if (c != null) c.VisibleChanged += new EventHandler(CustomizePopupItemParentVisibleChange);
                    }
                }
            }

            if (m_UseCustomizeDialog)
            {
                ButtonItem b = new ButtonItem(SysQatCustomizeItemName);
                b.Text = this.SystemText.QatCustomizeText;
                b.BeginGroup = true;
                b.Click += new EventHandler(CustomizeQuickAccessToolbarDialog);
                cont.SubItems.Add(b);
            }

            if (m_EnableQatPlacement && !m_UseExternalCustomization)
            {
                ButtonItem b = new ButtonItem(SysQatPlaceItemName);
                if (m_QatPositionedBelow)
                    b.Text = this.SystemText.QatPlaceAboveRibbonText;
                else
                    b.Text = this.SystemText.QatPlaceBelowRibbonText;
                b.Click += new EventHandler(QuickAccessToolbarChangePlacement);
                cont.SubItems.Add(b);
            }

            if (this.AutoExpand)
            {
                ButtonItem b = new ButtonItem(this.Expanded ? SysMinimizeRibbon : SysMaximizeRibbon, this.Expanded ? this.SystemText.MinimizeRibbonText : this.SystemText.MaximizeRibbonText);
                b.Click += new EventHandler(MinMaxRibbonClick);
                b.BeginGroup = true;
                cont.SubItems.Add(b);
            }

            RibbonCustomizeEventArgs e = new RibbonCustomizeEventArgs(o, cont);
            OnBeforeCustomizeMenuPopup(e);
            if (e.Cancel)
            {
                cont.Dispose();
                return;
            }

            ((IOwnerMenuSupport)m_RibbonStrip).RegisterPopup(cont);
            cont.Popup(Control.MousePosition);
        }
开发者ID:,项目名称:,代码行数:88,代码来源:


注:本文中的DevComponents.DotNetBar.ButtonItem.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。