Ejemplo n.º 1
0
        /// <summary>
        /// Adds the combo box.
        /// </summary>
        /// <param name="method">The method.</param>
        /// <param name="height">The height.</param>
        private void AddComboBox(Enum method, int height)
        {
            ComboBox tempCombo = null;
            try
            {
                tempCombo = new ComboBox();
                foreach (UpdatePeriod period in GetUpdatePeriods(method))
                {
                    string header = period.GetHeader();
                    if (period == UpdatePeriod.Never && method.HasForcedOnStartup())
                        header = "On Startup";

                    tempCombo.Items.Add(header);
                }
                tempCombo.Tag = method;
                tempCombo.SelectedIndex = 0;
                tempCombo.Margin = new Padding(3);
                tempCombo.Height = RowHeight - 4;
                tempCombo.Width = labelPeriod.Width;
                tempCombo.DropDownStyle = ComboBoxStyle.DropDownList;
                tempCombo.Location = new Point(labelPeriod.Location.X, height + 2);
                tempCombo.SelectedIndexChanged += combo_SelectedIndexChanged;

                ComboBox combo = tempCombo;
                tempCombo = null;

                Controls.Add(combo);
                m_combos.Add(combo);
            }
            finally
            {
                tempCombo?.Dispose();
            }
        }