Пример #1
0
 private void TsbAddAnswerClick(object sender, EventArgs e)
 {
     Control control = null;
     if (tscbAnswerType.SelectedIndex == 1)
     {
         control = new AnswerControl();
         Answers.Add(new Answer());
     }
     if (tscbAnswerType.SelectedIndex == 0)
     {
         control = new AgeDependsAnswerControl();
         Answers.Add(new AgeDependsAnswer());
     }
     if (control == null)
         throw new Exception("Не поддерживается тип для компонента.");
     int height = 0;
     foreach (AnswerControl answerControl in _answerControls)
     {
         height += answerControl.Height;
     }
     control.Top = height;
     _answerControls.Add(control as AnswerControl);
     pAnswerControls.Controls.Clear();
     pAnswerControls.Controls.AddRange(_answerControls.ToArray());
 }
Пример #2
0
        private void TsbAddAnswerClick(object sender, EventArgs e)
        {
            Control control = null;

            if (tscbAnswerType.SelectedIndex == 1)
            {
                control = new AnswerControl();
                Answers.Add(new Answer());
            }
            if (tscbAnswerType.SelectedIndex == 0)
            {
                control = new AgeDependsAnswerControl();
                Answers.Add(new AgeDependsAnswer());
            }
            if (control == null)
            {
                throw new Exception("Не поддерживается тип для компонента.");
            }
            int height = 0;

            foreach (AnswerControl answerControl in _answerControls)
            {
                height += answerControl.Height;
            }
            control.Top = height;
            _answerControls.Add(control as AnswerControl);
            pAnswerControls.Controls.Clear();
            pAnswerControls.Controls.AddRange(_answerControls.ToArray());
        }