예제 #1
0
        /// <summary>
        /// Adds a selection region to the form, consisting of a ComboBox and a Label (for indicating the purpose of the former).
        /// <para/>
        /// The value of the ComboBox in this region will be put into the <c>Value</c> property in the order the ComboBoxes
        /// are added onto the page.
        /// </summary>
        /// <param name="height">The current height of the control, used for adding controls down the form.</param>
        /// <param name="index">The current TabIndex of the controls added to the form.</param>
        /// <param name="label">The label for this particular ComboBox.</param>
        private void AddSelection(ref int height, ref int index, string label)
        {
            // add combo box
            ComboBox comboBoxControl = new ComboBox()
            {
                DropDownStyle = ComboBoxStyle.DropDownList,
                Height        = 23,
                Width         = ComboBoxWidth,
                Top           = height,
                Left          = 12 + LabelWidth + 8,
                TabIndex      = index++,
                Font          = this.Font
            };

            foreach (char possibleValue in PossibleValues)
            {
                // lack of value-type array covariance means I have to iterate this manually
                comboBoxControl.Items.Add(possibleValue);
            }
            comboBoxControl.SelectedIndex = 0;

            // add label
            Label labelControl = new Label()
            {
                Text      = label,
                TextAlign = System.Drawing.ContentAlignment.TopRight,
                AutoSize  = false,
                Height    = 15,
                Width     = LabelWidth,
                Top       = height + 3,
                Font      = this.Font,
                Left      = 12
            };

            ComboBoxes.Add(comboBoxControl);
            Controls.Add(comboBoxControl);
            Controls.Add(labelControl);
            height += 23 + 6;
        }
예제 #2
0
 public void AddComboBox(string name, RedComboBox checkBox)//addcheckboxhere!
 {
     ComboBoxes.Add(name, checkBox);
 }