public void addControls(Point point, out Point next) { bool failed; int weight = module.sumAssessmentWeight(); double moduleScore = module.score(out failed); Point curpoint = new Point(point.X, point.Y); modCode.Text = module.getCode(); modCode.Location = curpoint; modCode.Width -= 40; curpoint = new Point(curpoint.X + modCode.Width + 5, curpoint.Y); modName.Text = module.getName(); modName.Location = curpoint; modName.Width += 120; curpoint = new Point(curpoint.X + modName.Width, curpoint.Y); modCerdits.Text = "Credits " + module.getCredit().ToString(); modCerdits.Location = curpoint; modCerdits.Width -= 30; curpoint = new Point(curpoint.X + modCerdits.Width + 5, curpoint.Y); modAvg.Text = "Overall: " + moduleScore + "%" + (weight < 100 ? " (incomplete)" : ""); modAvg.Location = curpoint; if (moduleScore <= 30) { modAvg.ForeColor = System.Drawing.Color.Red; } else if (moduleScore >= 30 && moduleScore < 60) { modAvg.ForeColor = System.Drawing.Color.Green; } else if (moduleScore >= 60) { modAvg.ForeColor = System.Drawing.Color.Blue; } modAvg.Width += 50; curpoint = new Point(curpoint.X + modAvg.Width + 5, curpoint.Y); modStatus.Text = moduleScore >= 40.0 && !failed ? "Pass" : (moduleScore >= 30.0 && !failed ? "Reffered" : "Fail"); modStatus.Location = curpoint; curpoint = new Point(curpoint.X + modStatus.Width + 5, curpoint.Y); root.Controls.Add(modCode); root.Controls.Add(modName); root.Controls.Add(modCerdits); root.Controls.Add(modAvg); root.Controls.Add(modStatus); next = new Point(point.X, curpoint.Y + modCerdits.Height); }
public void addControls(Point point, out Point next) { bool failed; int weight = module.sumAssessmentWeight(); double moduleScore = module.score(out failed); Point curpoint = new Point(point.X, point.Y); modCodeLabel.Text = "Code: " + module.getCode(); modCodeLabel.Location = curpoint; curpoint = new Point(curpoint.X + modCodeLabel.Width + 5, curpoint.Y); modName.Text = "Name: " + module.getName(); modName.Location = curpoint; modName.Width += 120; curpoint = new Point(curpoint.X + modName.Width + 5, curpoint.Y); modCerdits.Text = "Credits " + module.getCredit().ToString(); modCerdits.Location = curpoint; modCerdits.Width -= 30; curpoint = new Point(curpoint.X + modCerdits.Width + 5, curpoint.Y); modAssessments.Text = "Assessments"; modAssessments.Location = curpoint; modAssessments.Click += new EventHandler(moduleAssessments_Click); curpoint = new Point(curpoint.X + modAssessments.Width + 5, curpoint.Y); modEdit.Text = "Edit"; modEdit.Location = curpoint; modEdit.Click += new EventHandler(moduleEdit_Click); curpoint = new Point(curpoint.X + modEdit.Width + 5, curpoint.Y); modDelete.Text = "Delete"; modDelete.Location = curpoint; modDelete.Click += new EventHandler(moduleDelete_Click); modDelete.Click += updateTabEH; curpoint = new Point(curpoint.X + modDelete.Width + 5, curpoint.Y); modAvg.Text = "Average: " + moduleScore + "%" + (weight < 100 ? " (incomplete)" : ""); modAvg.Location = curpoint; modAvg.Width += 50; if (moduleScore <= 30) { modAvg.ForeColor = System.Drawing.Color.Red; } else if (moduleScore >= 30 && moduleScore < 60) { modAvg.ForeColor = System.Drawing.Color.Green; } else if (moduleScore >= 60) { modAvg.ForeColor = System.Drawing.Color.Blue; } curpoint = new Point(curpoint.X + modAvg.Width + 5, curpoint.Y); modStatus.Text = moduleScore >= 40.0 && !failed ? "Pass" : (moduleScore >= 30.0 && !failed ? "Reffered" : "Fail"); modStatus.Location = curpoint; curpoint = new Point(curpoint.X + modStatus.Width + 5, curpoint.Y); root.Controls.Add(modCodeLabel); root.Controls.Add(modName); root.Controls.Add(modCerdits); root.Controls.Add(modAssessments); root.Controls.Add(modEdit); root.Controls.Add(modDelete); root.Controls.Add(modAvg); root.Controls.Add(modStatus); next = new Point(point.X, point.Y + modAssessments.Height); }