public MultiVariantPassControl(MultiQuestionAnswer multiQuestionAnswer, bool isPreviewState)
        {
            InitializeComponent();
            answer       = multiQuestionAnswer;
            VariantMulti = new List <CheckBox>();
            //Добавление вариантов в случайном порядке
            var added_indexes = new HashSet <int>();
            var rnd           = new Random();
            var graphics      = CreateGraphics();

            for (var i = 0; i < multiQuestionAnswer.Variants.Count; i++)
            {
                int index;
                do
                {
                    index = rnd.Next(0, multiQuestionAnswer.Variants.Count);
                }while (added_indexes.Contains(index));
                added_indexes.Add(index);
                VariantMulti.Add(OleXisTest.Controls.GetCheckBox(multiQuestionAnswer.Variants[i], OleXisTest.Controls.GetStringWidth(multiQuestionAnswer.Variants[i], graphics) + 20, index * OleXisTest.Controls.PASSING_RADIOBUTTON_INDENT_Y, this));
                if (isPreviewState)
                {
                    VariantMulti.Last().AutoCheck = false;
                    if (multiQuestionAnswer.Answers.Contains(i))
                    {
                        VariantMulti.Last().Checked = true;
                    }
                }
            }
        }
Example #2
0
 public MultiVariantEditControl(MultiQuestionAnswer multiQuestionAnswer) : this()
 {
     for (var i = 0; i < multiQuestionAnswer.Variants.Count; i++)
     {
         AddVariant();
         TextVariant[i].Text = multiQuestionAnswer.Variants[i];
         if (multiQuestionAnswer.Answers.Contains(i))
         {
             CorrectVariantMulti[i].Checked = true;
         }
     }
 }
 public MultiQuestionAnswer(MultiQuestionAnswer answerToClone)
 {
     Variants = new List <string>(answerToClone.Variants);
     Answers  = new List <int>(answerToClone.Answers);
 }