Пример #1
0
        /// <summary>
        /// Adds buttons to the toolbar.
        /// </summary>
        private void AddToolButtons()
        {
            btnAdd.Visible           = false;
            btnAddWithChoice.Visible = false;
            ToolStripItem[] buttons = configProvider.GetAddButtons();

            if (buttons != null)
            {
                if (buttons.Length > 1)
                {
                    btnAddWithChoice.Visible = true;
                    btnAddWithChoice.DropDownItems.AddRange(buttons);
                }
                else if (buttons.Length > 0)
                {
                    btnAdd.Visible     = true;
                    btnAdd.ToolTipText = buttons[0].Text;
                }

                foreach (ToolStripItem button in buttons)
                {
                    button.Click += btnAdd_Click;
                }
            }
        }