public void AddAnswers(Answers Answers) { this.SuspendLayout(); _answers = Answers; int y = 0; pb_progress.Value = 0; pb_progress.Minimum = 0; pb_progress.Step = 1; pb_progress.Maximum = _answers.Count; btn_recog.Enabled = false; for (int i = 0; i < _answers.Count; i++) { AnswerControl newAC = new AnswerControl(); newAC.CreateCells(_answers[i]); newAC.Location = new Point(5, y); _aclist.Add(newAC); newAC.btn_ans.Click += new EventHandler(btn_ans_Click); newAC.CellSelect += new EventHandler(newAC_CellSelect); newAC.NullSelect += new EventHandler(newAC_NullSelect); newAC.CellIndexTextBox.GotFocus += new EventHandler(CellIndexTextBox_GotFocus); newAC.CellIndexTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.c_KeyDown); newAC.MouseEnter += new EventHandler(newAC_MouseEnter); PanelChild.Controls.Add(newAC); pb_progress.PerformStep(); y += newAC.Size.Height + 2; Application.DoEvents(); } btn_recog.Enabled = true; this.ResumeLayout(true); }
void newAC_CellSelect(object sender, EventArgs e) { AnswerControl ac = (AnswerControl)sender; arg.CurrentAnsverControl = ac; arg.ControlType = ControlType.Cell; this.OnAnswerSelect(); }
void btn_ans_Click(object sender, EventArgs e) { Button b = (Button)sender; AnswerControl ac = (AnswerControl)b.Parent; arg.CurrentAnsverControl = ac; arg.ControlType = ControlType.Button; this.OnAnswerSelect(); }
void CellIndexTextBox_GotFocus(object sender, EventArgs e) { TextBox tb = (TextBox)sender; AnswerControl ac = (AnswerControl)tb.Parent; arg.CurrentAnsverControl = ac; arg.ControlType = ControlType.Button; this.OnAnswerSelect(); }
public void SetTollTips(AnswerControl control) { answersparam aparam = _testparam.answersparams.First(a => a.num == control.Answer.Id); string label = aparam.buttondescription.Trim(); if (control.Answer.ContentDescription.Trim() != "") { cellsparam c = _ge.cellsparams.First(cp => cp.ida == aparam.ida & cp.description == control.Answer.ContentDescription.Trim()); label += ": \n" + c.buttonsescription; } else { label += ": \n нет ответа"; } RemarkToolTip.SetToolTip(control.btn_ans, label); }
private void PictAnswerOnCenter(AnswerControl selectedanswer) { p_parent.AutoScrollPosition = new Point(selectedanswer.Answer.Cells[0].CenterOfGravity.X - 100, selectedanswer.Answer.Cells[0].CenterOfGravity.Y - 100); }
public void AddAnswers(Answers Answers) { this.SuspendLayout(); _answers = Answers; int y = 0; pb_progress.Value = 0; pb_progress.Minimum = 0; pb_progress.Step = 1; pb_progress.Maximum = _answers.Count; btn_recog.Enabled = false; for (int i = 0; i < _answers.Count; i++) { AnswerControl newAC = new AnswerControl(); newAC.CreateCells(_answers[i]); newAC.Location = new Point(5, y); _aclist.Add(newAC); newAC.btn_ans.Click += new EventHandler(btn_ans_Click); newAC.CellSelect += new EventHandler(newAC_CellSelect); newAC.NullSelect += new EventHandler(newAC_NullSelect); newAC.CellIndexTextBox.GotFocus += new EventHandler(CellIndexTextBox_GotFocus); newAC.CellIndexTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.c_KeyDown); newAC.MouseEnter += new EventHandler(newAC_MouseEnter); PanelChild.Controls.Add(newAC); pb_progress.PerformStep(); y += newAC.Size.Height + 2; Application.DoEvents(); } btn_recog.Enabled = true; this.ResumeLayout(true); }