Ejemplo n.º 1
0
 private void RadioChoiceChanged(RadioChoiceControl radioChoice)
 {
     if (radioChoice.remove)
     {
         if (question.choices.Count > 2)
         {
             question.choices.RemoveAt(radioChoice.index);
             foreach (RadioChoiceControl radioChoiceControl in radioChoiceControls)
             {
                 if (radioChoice.index < radioChoiceControl.index)
                 {
                     radioChoiceControl.index--;
                 }
             }
             this.panel1.Controls.Remove(radioChoice);
             this.Height -= QUESTION_HEIGH;
         }
         else
         {
             MessageBox.Show("A question can't have less than two choices", "Error", MessageBoxButtons.OK);
         }
     }
     else
     {
         question.choices[radioChoice.index] = radioChoice.choice;
     }
 }
Ejemplo n.º 2
0
        private void addRadioChoice(string choice)
        {
            RadioChoiceControl radioChoice = new RadioChoiceControl(choice, controls_index);

            radioChoice.Dock             = DockStyle.Top;
            radioChoice.AutoScaleMode    = AutoScaleMode.None;
            radioChoice.Height           = QUESTION_HEIGH;
            radioChoice.Visible          = true;
            radioChoice.PropertyChanged += ChoiceChanged;
            this.panel1.Controls.Add(radioChoice);
            this.panel1.Controls.SetChildIndex(radioChoice, 0);
            this.radioChoiceControls.Add(radioChoice);
            this.Height += QUESTION_HEIGH;
            controls_index++;
        }