/// <summary> /// How to draw a class that has been selected /// </summary> /// <param name="g"></param> protected virtual void drawSpecificClass(Graphics g) { if (selectedCourse == null) { state = CourseListState.ClassList; return; } g.FillRectangle(courseColor2, 2, 2, this.Size.Width - 4, this.Size.Height - 4); Font font = new Font(FontFamily.GenericSansSerif, 14); string text = selectedCourse.CourseID; SizeF textSize = g.MeasureString(text, font); g.DrawString(selectedCourse.CourseID, font, Brushes.Black, 4, 4 + (textSize.Height + 4) * 0); g.DrawString(selectedCourse.CourseName, font, Brushes.Black, 4, 4 + (textSize.Height + 4) * 1); if (selectedCourse.Teacher != null) { g.DrawString(selectedCourse.Teacher, font, Brushes.Black, 4, 4 + (textSize.Height + 4) * 2); } text = selectedCourse.DaysOfWeekPresent; textSize = g.MeasureString(text, font); g.DrawString(text, font, Brushes.Black, cellWidth - textSize.Width - 4, 4 + (textSize.Height + 4) * 2); if (text != "Online") { text = Converter.TimeIntToString(selectedCourse.StartTime) + " - " + Converter.TimeIntToString(selectedCourse.EndTime); textSize = g.MeasureString(text, font); g.DrawString(text, font, Brushes.Black, cellWidth - textSize.Width - 4, 4 + (textSize.Height + 4) * 0); } drawSelectedCourseExtra(g); }
/// <summary> /// Checks to see if the list of classes has been clicked anywhere /// </summary> /// <param name="mx"></param> /// <param name="my"></param> protected void ClickClassList(int mx, int my) { if (!CheckBottomBarClick(mx, my)) { if (my < this.Size.Height - this.bottomBarHeight) { int index = (my / cellHeight) + currPage * numbersPerPage; if (index >= courses.Count) { return; } selectedCourse = courses?[index]; if (selectedCourse != null) { state = CourseListState.SpecificClass; } } } }
public void ResetToDefault() { state = CourseListState.ClassList; selectedCourse = null; }