/// <summary>
        /// Replaces combobox control
        /// </summary>
        /// <param name="control">The replaced control</param>
        /// <param name="num">Number of comboboxes</param>
        /// <returns>Replacing result</returns>
        public static Control Replace(Control control, int num)
        {
            if (num == 0)
            {
                if (control is Panel)
                {
                    return(control);
                }
                Control p   = Remove(control);
                Panel   pan = Panel;
                p.Controls.Add(pan);
                return(pan);
            }
            UserControlComboboxList ucl = null;

            if (control is UserControlComboboxList)
            {
                ucl = control as UserControlComboboxList;
                if (ucl.Count == num)
                {
                    return(ucl);
                }
                ucl.Count = num;
                return(ucl);
            }
            Control par = Remove(control);

            ucl       = new UserControlComboboxList();
            ucl.Count = num;
            ucl.Dock  = DockStyle.Fill;
            par.Controls.Add(ucl);
            return(ucl);
        }
        /// <summary>
        /// Gets selected combobox items of control
        /// </summary>
        /// <param name="control">The control</param>
        /// <returns>The items</returns>
        public static string[] GetSelected(Control control)
        {
            if (!(control is UserControlComboboxList))
            {
                return(new string[0]);
            }
            UserControlComboboxList uc = control as UserControlComboboxList;

            return(uc.Selected);
        }
        private void Add()
        {
            int n = list.Count;
            UserControlComboboxList fin = list[n - 1];
            UserControlComboboxList uc  = new UserControlComboboxList(list);

            for (int i = 0; i < n; i++)
            {
                list[i].Height += height;
            }
            uc.Dock           = DockStyle.Fill;
            uc.labelText.Font = labelText.Font;
            fin.panelCenter.Controls.Add(uc);
        }
        /// <summary>
        /// Replaces control by new texts
        /// </summary>
        /// <param name="control">The control</param>
        /// <param name="texts">Texts</param>
        /// <returns>Replacing result</returns>
        public static Control Replace(Control control, string[] texts)
        {
            if (texts == null)
            {
                return(Replace(control, 0));
            }
            Control c = Replace(control, texts.Length);

            if (c is UserControlComboboxList)
            {
                UserControlComboboxList uc = c as UserControlComboboxList;
                uc.Texts = texts;
            }
            return(c);
        }
 /// <summary>
 /// Creates Combo control
 /// </summary>
 /// <param name="texts">Texts</param>
 /// <returns>Created control</returns>
 public static Control CreateComboboxControl(string[] texts)
 {
     if (texts != null)
     {
         if (texts.Length > 0)
         {
             UserControlComboboxList uc = new UserControlComboboxList();
             uc.Count = texts.Length;
             uc.Texts = texts;
             uc.Dock  = DockStyle.Fill;
             return(uc);
         }
     }
     return(Panel);
 }
        void Remove()
        {
            if (list.Count == 1)
            {
                return;
            }
            int n = list.Count;
            UserControlComboboxList fin = list[n - 1];
            UserControlComboboxList pre = list[n - 2];

            pre.panelCenter.Controls.Remove(fin);
            list.Remove(fin);
            for (int i = 0; i < list.Count; i++)
            {
                list[i].Height -= height;
            }
        }