public override void OnDrawItemText(CalendarRendererBoxEventArgs e) { int nbLines = CountLines(e.Text); double divider = 1; if (nbLines < 4) { divider = 14.1; } else if (nbLines < 5) { divider = 17.5; } else if (nbLines < 6) { divider = 22; } else if (nbLines < 7) { divider = 29; } double textSize = Calendar.Days[0].Bounds.Height / divider; Font newFont = new Font(Calendar.Font.FontFamily, (float)textSize); e.Font = newFont; base.OnDrawItemText(e); }
public override void OnDrawItemEndTime(CalendarRendererBoxEventArgs e) { if (e.TextColor.IsEmpty) { e.TextColor = ColorTable.ItemSecondaryText; } base.OnDrawItemEndTime(e); }
public override void OnDrawDayNameHeader(CalendarRendererBoxEventArgs e) { e.TextColor = ColorTable.WeekDayName; base.OnDrawDayNameHeader(e); using (Pen p = new Pen(ColorTable.WeekDayName)) { e.Graphics.DrawLine(p, e.Bounds.Right, e.Bounds.Top, e.Bounds.Right, e.Bounds.Bottom); } }
public override void OnDrawItemText(CalendarRendererBoxEventArgs e) { CalendarItem item = e.Tag as CalendarItem; if (item != null) { if (item.IsDragging) { e.TextColor = Color.FromArgb(120, e.TextColor); } } base.OnDrawItemText(e); }
public override void OnDrawWeekHeader(CalendarRendererBoxEventArgs e) { if (e.Bounds.Height <= 0 || e.Bounds.Width <= 0) { return; } using (Brush b = new SolidBrush(ColorTable.WeekHeaderBackground)) { e.Graphics.FillRectangle(b, e.Bounds); } using (Pen p = new Pen(ColorTable.WeekHeaderBorder)) { e.Graphics.DrawRectangle(p, e.Bounds); } e.TextColor = ColorTable.WeekHeaderText; base.OnDrawWeekHeader(e); }
public override void OnDrawTimeScaleMinutes(CalendarRendererBoxEventArgs e) { e.TextColor = ColorTable.TimeScaleMinutes; base.OnDrawTimeScaleMinutes(e); }