void schedulerControl1_CustomDrawAppointment(object sender, CustomDrawObjectEventArgs e) { SchedulerControl scheduler = (SchedulerControl)sender; if (scheduler.ActiveViewType == SchedulerViewType.Day) { AppointmentViewInfo aptViewInfo = (AppointmentViewInfo)e.ObjectInfo; if (aptViewInfo.Selected) { Appointment apt = aptViewInfo.Appointment; SolidBrush brush = new SolidBrush((drag ? Color.FromArgb(32, 0, 0, 0) : Color.FromArgb(16, 0, 0, 0))); TimeSpan timeScale = scheduler.DayView.TimeScale; DateTime safeIntervalStart = (DateTime)apt.CustomFields["SafeIntervalStartCF"]; DateTime safeIntervalEnd = (DateTime)apt.CustomFields["SafeIntervalEndCF"]; int cellsCount = (int)((safeIntervalEnd - safeIntervalStart).Ticks / timeScale.Ticks); SchedulerViewCellBaseCollection cells = scheduler.DayView.ViewInfo.CellContainers[0].Cells; Rectangle topBounds = Rectangle.Empty; Rectangle bottomBounds = Rectangle.Empty; List <Rectangle> secondaryBounds = new List <Rectangle>(); Rectangle generalBounds = Rectangle.Empty; InitializeBoundsInfo(safeIntervalStart, safeIntervalEnd, cells, ref topBounds, ref bottomBounds, secondaryBounds, ref generalBounds, aptViewInfo.Bounds); Draw(e, brush, ref topBounds, ref bottomBounds, secondaryBounds, ref generalBounds); } } }
private void PrepareToolTipCells() { SchedulerViewCellContainerCollection containers = GetCellContainers(schedulerControl1.ActiveView); for (int i = 0; i < containers.Count; i++) { SchedulerViewCellBaseCollection cells = containers[i].Cells; for (int n = 0; n < cells.Count; n++) { cells[n].ShouldShowToolTip = true; cells[n].ToolTipText = "Text value shouldn't be empty"; } } }
private static void InitializeBoundsInfo(DateTime safeIntervalStart, DateTime safeIntervalEnd, SchedulerViewCellBaseCollection cells, ref Rectangle topBounds, ref Rectangle bottomBounds, List <Rectangle> secondaryBounds, ref Rectangle generalBounds, Rectangle aptBounds) { for (int i = 0; i < cells.Count; i++) { SchedulerViewCellBase cell = cells[i]; if (cell.Interval.Contains(safeIntervalStart) && cell.Interval.End > safeIntervalStart) { topBounds = cell.Bounds; topBounds.Width = aptBounds.Width; topBounds.X = aptBounds.X; } else if (cell.Interval.Contains(safeIntervalEnd) && cell.Interval.Start < safeIntervalEnd) { bottomBounds = cell.Bounds; bottomBounds.Width = aptBounds.Width; bottomBounds.X = aptBounds.X; } else if (cell.Interval.Start > safeIntervalStart && cell.Interval.End < safeIntervalEnd) { secondaryBounds.Add(new Rectangle() { X = aptBounds.X, Y = cell.Bounds.Y, Width = aptBounds.Width, Height = cell.Bounds.Height }); } if (generalBounds.X > cell.Bounds.X) { generalBounds.X = cell.Bounds.X; } if (generalBounds.Y > cell.Bounds.Y) { generalBounds.Y = cell.Bounds.Y; } if (generalBounds.Width < cell.Bounds.Right) { generalBounds.Width = cell.Bounds.Right - generalBounds.X; } if (generalBounds.Bottom < cell.Bounds.Bottom) { generalBounds.Height = cell.Bounds.Bottom - generalBounds.Y; } } }