コード例 #1
0
        /// <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);
            }
            UserControlHeteroContainer ucc = null;

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

            ucc       = new UserControlHeteroContainer();
            ucc.Count = num;
            ucc.Dock  = DockStyle.Fill;
            par.Controls.Add(ucc);
            return(ucc);
        }
コード例 #2
0
        private void Add()
        {
            int n = list.Count;
            UserControlHeteroContainer fin = list[n - 1];
            UserControlHeteroContainer uc  = new UserControlHeteroContainer(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);
        }
コード例 #3
0
        /// <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 UserControlHeteroContainer)
            {
                UserControlHeteroContainer uc = c as UserControlHeteroContainer;
                uc.Texts = texts;
            }
            return(c);
        }
コード例 #4
0
        void Remove()
        {
            if (list.Count == 1)
            {
                return;
            }
            int n = list.Count;
            UserControlHeteroContainer fin = list[n - 1];
            UserControlHeteroContainer pre = list[n - 2];

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