private void OK_Click(object sender, EventArgs e) { if (CheckMarks()) { byte[][] marks = new byte[StringEquivalents.Nsemestrs][]; for (int i = 0; i < StringEquivalents.Nsemestrs; i++) { marks[i] = semesters[i].GetNewMarksArray(); } record.GetExams().ChangeMarks(ref marks); form.Close(); } else { MessageBox.Show("Incorrect marks", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public MyGroupBox(COneRecord record, int index) { Main = new GroupBox(); Main.Text = "Semestr " + (index + 1).ToString(); condition = record.GetExams().Semesters[index].Condition; //MessageBox.Show("Comd" + (int)condition); System.Drawing.Point location; if (index < 4) { location = new System.Drawing.Point(5, 90 * (index + 1)); } else { location = new System.Drawing.Point(5 + 280, 90 * (index - 4 + 1)); } Main.Width = 270; Main.Height = 90; Main.Location = location; switch (condition) { case EConditions.MustBeFilled: Main.BackColor = System.Drawing.Color.FromArgb(127, 255, 255, 0); break; case EConditions.CanBeFilled: Main.BackColor = System.Drawing.Color.FromArgb(127, 0, 0, 255); break; case EConditions.CanTBeFilled: Main.BackColor = System.Drawing.Color.FromArgb(127, 128, 128, 128); break; } System.Drawing.Point loc = new System.Drawing.Point(5, 25); System.Drawing.Point locm = new System.Drawing.Point(5, 50); Sub = new Label[StringEquivalents.NExams]; Results = new ComboBox[StringEquivalents.NExams]; for (int i = 0; i < StringEquivalents.NExams; i++) { Sub[i] = new Label(); Results[i] = new ComboBox(); switch (condition) { case EConditions.MustBeFilled: case EConditions.CanBeFilled: Results[i].Enabled = true; break; case EConditions.CanTBeFilled: Results[i].Enabled = false; break; } Sub[i].Width = Results[i].Width = 40; Sub[i].Text = StringEquivalents.SubjectNames[(int)(record.GetExams()[index, i].Subject)]; Results[i].Text = StringEquivalents.Marks[(int)record.GetExams()[index, i].Mark]; Sub[i].Font = Results[i].Font = new System.Drawing.Font("Times New Roman", 10); Results[i].Items.AddRange(StringEquivalents.Marks); Sub[i].Location = loc; Results[i].Location = locm; Results[i].TextChanged += ShowEditMarks_TextChanged; Main.Controls.Add(Sub[i]); Main.Controls.Add(Results[i]); loc.X += 40; locm.X += 40; } }