public static void scheduler_CustomDrawTimeIndicator(object sender, DevExpress.XtraScheduler.CustomDrawObjectEventArgs e) { TimeIndicatorViewInfo info = e.ObjectInfo as TimeIndicatorViewInfo; SchedulerControl scheduler = sender as SchedulerControl; foreach (var item in info.Items) { TimeIndicatorBaseItem timeIndicatorItem = item as TimeIndicatorBaseItem; if (timeIndicatorItem != null) { e.DrawDefault(); Rectangle boundsText = Rectangle.Empty; if (scheduler.ActiveView is DayView) { boundsText = Rectangle.Inflate(timeIndicatorItem.Bounds, 0, 5); boundsText.Offset(((int)e.Graphics.ClipBounds.Width / 2), -10); } e.Cache.DrawString(info.Interval.Start.ToString(), scheduler.Appearance.HeaderCaption.Font, new SolidBrush(Color.Red), boundsText, scheduler.Appearance.HeaderCaption.GetStringFormat()); } } e.Handled = true; }
private void SchedulerControl1_CustomDrawTimeIndicator(object sender, CustomDrawObjectEventArgs e) { TimeIndicatorViewInfo info = e.ObjectInfo as TimeIndicatorViewInfo; SchedulerControl scheduler = sender as SchedulerControl; e.DrawDefault(); foreach (var item in info.Items) { HorizontalTimeIndicatorCircleItem timeIndicatorItem = item as HorizontalTimeIndicatorCircleItem; if (timeIndicatorItem != null) { Rectangle boundsText = Rectangle.Empty; if (scheduler.ActiveView is DayView) { boundsText = Rectangle.Inflate(new Rectangle(item.Bounds.X + 5, item.Bounds.Y - 3, scheduler.ActiveView.ViewInfo.Bounds.Width - 5, 10), 0, 5); boundsText.Offset(((int)e.Graphics.ClipBounds.Width / 2), -10); } e.Cache.DrawString(info.Interval.Start.ToString(), scheduler.Appearance.HeaderCaption.GetFont(), textBrush, boundsText, scheduler.Appearance.HeaderCaption.GetStringFormat()); e.Cache.FillRectangle(textBrush, new Rectangle(item.Bounds.X + 5, item.Bounds.Y, scheduler.ActiveView.ViewInfo.Bounds.Width - 5, 2)); } } e.Handled = true; }