private void button2_Click(object sender, EventArgs e) { groupBox1.Visible = false; groupBox2.Visible = false; groupBox3.Visible = false; button1.Enabled = true; if (i >= absinfo.Count - 3) { end = true; button2.Enabled = false; } if (i < absinfo.Count - 3) { for (int j = 0; j < 3; j++, i++) { info student = (info)absinfo[i]; fresh(student, j); } } else { for (int j = 0; i < absinfo.Count; j++, i++) { info student = (info)absinfo[i]; fresh(student, j); } } }
private void button1_Click(object sender, EventArgs e) { groupBox1.Visible = false; groupBox2.Visible = false; groupBox3.Visible = false; button2.Enabled = true; if (end) { if (i % 3 != 0) { i -= i % 3 + 3; } else { i -= 6; } } else { i -= 6; } if (i == 0) { button1.Enabled = false; } for (int j = 0; j < 3; j++, i++) { info student = (info)absinfo[i]; fresh(student, j); } end = false; }
private void absence_Load(object sender, EventArgs e) { groupBox1.Visible = false; groupBox2.Visible = false; groupBox3.Visible = false; button1.Enabled = false; button2.Enabled = false; excelio cell = excelio.getInstance(); if (filePath != null) { cell.openfile(filePath); if (absence != null) { button2.Enabled = true; foreach (long sn in absence) { absinfo.Add(new info(cell.getstudentname(sn), sn, cell.getabsencenum(sn))); } if (absinfo.Count >= 3) { if (absinfo.Count == 3) { button2.Enabled = false; } for (i = 0; i < 3; i++) { info student = (info)absinfo[i]; fresh(student, i); } } else { button2.Enabled = false; for (i = 0; i < absinfo.Count; i++) { info student = (info)absinfo[i]; fresh(student, i); } } } } }
private void fresh(info std, int i) { PictureBox pic = null; Label sn = null; Label name = null; Label abs = null; GroupBox box = null; if (i == 0) { pic = pic1; sn = sn1; name = name1; abs = absnum1; box = groupBox1; } if (i == 1) { pic = pic2; sn = sn2; name = name2; abs = absnum2; box = groupBox2; } if (i == 2) { pic = pic3; sn = sn3; name = name3; abs = absnum3; box = groupBox3; } pic.LoadAsync(Application.StartupPath + @"/photos/" + std.getsn() + @".jpg"); sn.Text = std.getsn().ToString(); name.Text = std.getname(); abs.Text = std.getabsnum().ToString(); box.Visible = true; }