コード例 #1
0
ファイル: QuestionForm.cs プロジェクト: ekaprayugo/NgopiMain
        public QuestionForm(Question question = null)
        {
            InitializeComponent();
            answerListBox.DisplayMember = "Printout";
            this.question = question;

            if (this.question != null) {
                nameTextBox.Text = this.question.Name;

                requiredCheckBox.Checked = this.question.Required;

                colorButton.BackColor = this.question.ButtonColor;
                if (colorButton.BackColor.GetBrightness() < 0.5) colorButton.ForeColor = Color.White;
                else colorButton.ForeColor = Color.Black;

                if (this.question.Type == Question.QuestionType.SingleAnswer) singleRadioButton.Checked = true;
                else multipleRadioButton.Checked = true;

                foreach (Answer answer in question.Answers) {
                    answerListBox.Items.Add(answer);
                }
            } else this.question = new Question();
        }
コード例 #2
0
ファイル: Answer.cs プロジェクト: ekaprayugo/NgopiClasses
 public Answer(string name, decimal cost, Question owner)
 {
     this.name = name;
     this.cost = cost;
     this.owner = owner;
 }