private Rectangle TimeslotRectangle(Timeslot t, ClashRectangle clashRectangle = ClashRectangle.None) { var r = new Rectangle(_table.Location, CellSize); switch (clashRectangle) { case ClashRectangle.Left: { r.Width /= 2; break; } case ClashRectangle.Right: { r.Width /= 2; r.Offset(r.Width, 0); break; } } r.Offset(CellSize.Width * (t.Day - (_showWeekend ? 0 : 1)), CellSize.Height * (t.Start.DayMinutes - HourStart * 60) / 60); r.Height = (int)Math.Ceiling(t.TotalMinutes / 60f * CellSize.Height); return(r); }
private void DrawSession(Graphics g, Session session) { //TODO: find clashes ClashRectangle clashRectangle = ClashRectangle.None; //FindClickTime() DrawTimeslot(g, session, (_grayscale ? Color.DarkGray : session.Stream.Type.Subject.Colour), _activeStream == session.Stream, clashRectangle); if (_showText) { DrawTimeslotText(g, session); } }
private void DrawTimeslot(Graphics g, Timeslot t, Color colour, bool active = false, ClashRectangle cr = ClashRectangle.None) { var r = TimeslotRectangle(t, cr); var b = LinearGradient(r.Location, CellSize.Height, colour, active); // solid color g.FillRectangle(new SolidBrush(colour), r); var q = new Rectangle(r.X, r.Y, r.Width, r.Height); if (r.Height > CellSize.Height * 2) { r.Height = CellSize.Height * 2; } g.FillRectangle(b, r); g.DrawRectangle(Pens.Black, q); }