/// <summary>
        /// Initialize a new instance of the KryptonDropButtonActionList class.
        /// </summary>
        /// <param name="owner">Designer that owns this action list instance.</param>
        public KryptonDropButtonActionList(KryptonDropButtonDesigner owner)
            : base(owner.Component)
        {
            // Remember the button instance
            _dropButton = owner.Component as KryptonDropButton;

            // Cache service used to notify when a property has changed
            _service = (IComponentChangeService)GetService(typeof(IComponentChangeService));
        }
        private void CreatePluginContextMenu()
        {
            if (this.obj != null)
            {
                IEnumerable <DataPlugin> plugins = Plugins.GetPlugins(this.obj.ObjectClass.Identifier);
                if (plugins.Count() > 0)
                {
                    Control button;
                    if (plugins.Count() == 1)
                    {
                        button = new KryptonButton();
                    }
                    else
                    {
                        button = new KryptonDropButton();
                    }

                    button.Text     = Strings.ButtonPlugin;
                    button.Location = new System.Drawing.Point(12, Height - 71);
                    button.Size     = new System.Drawing.Size(120, 25);
                    button.Anchor   = AnchorStyles.Left | AnchorStyles.Bottom;
                    Controls.Add(button);
                    if (plugins.Count() > 1)
                    {
                        KryptonContextMenu      menu  = new KryptonContextMenu();
                        KryptonContextMenuItems items = new KryptonContextMenuItems();
                        menu.Items.Add(items);
                        foreach (DataPlugin plugin in plugins)
                        {
                            KryptonContextMenuItem item = new KryptonContextMenuItem(plugin.GetName(), this.MenuPluginClick);
                            item.Tag = plugin;
                            items.Items.Add(item);
                        }

                        ((KryptonDropButton)button).KryptonContextMenu = menu;
                    }
                    else
                    {
                        button.Tag    = plugins.First();
                        button.Click += new EventHandler(this.ButtonPluginClick);
                    }
                }
            }
        }
Esempio n. 3
0
 public KryptonDropButtonProxy(KryptonDropButton comboBox)
 {
     _dropDown = comboBox;
 }
 public KryptonDropButtonToolStripItem() : base(new KryptonDropButton())
 {
     _button             = Control as KryptonDropButton;
     _button.Text        = "Button";
     _button.ButtonStyle = ButtonStyle.LowProfile;
 }