Exemplo n.º 1
0
        public static void scheduler_LayoutViewInfoCustomizing(object sender, LayoutViewInfoCustomizingEventArgs e)
        {
            string s = e.ViewInfo.GetType().ToString().Substring("DevExpress.XtraScheduler.Drawing.".Length);

            if (e.Kind == LayoutElementKind.DateHeader)
            {
                SchedulerHeader header = e.ViewInfo as SchedulerHeader;
                if (header != null)
                {
                    header.Caption = s;
                }
            }
            if (e.Kind == LayoutElementKind.Cell)
            {
                SchedulerViewCellBase cell = e.ViewInfo as SchedulerViewCellBase;
                if (cell != null)
                {
                    cell.Appearance.BackColor = Color.LightYellow;
                }
                SingleWeekCellBase cellWeek = e.ViewInfo as SingleWeekCellBase;
                if (cellWeek != null)
                {
                    cellWeek.Appearance.BackColor = Color.LightCyan;
                    cellWeek.Header.Caption       = s;
                }
            }
        }
        public override string GetVerticalWeekCellHeaderCaption(SchedulerHeader header)
        {
            DateTime date = header.Interval.Start.Date;

            if (date.Month == 1 && date.Day == 1)
            {
                return("VerticalWeekCellHeader");
            }
            else
            {
                return(base.GetVerticalWeekCellHeaderCaption(header));
            }
        }
 private void schedulerControl1_CustomDrawDayHeader(object sender, CustomDrawObjectEventArgs e)
 {
     #region #CustomDrawDayHeader
     // Check whether the current object is a Day Header.
     SchedulerHeader header = e.ObjectInfo as SchedulerHeader;
     if (header != null)
     {
         // Check whether the current date is a known holiday.
         Holiday hol = FindHoliday(header.Interval.Start.Date);
         if (hol != null)
         {
             header.Caption = hol.DisplayName;
             e.DrawDefault();
             // Add the holiday name to the day header's caption.
             Image     img     = Image.FromFile("Kuwait.png");
             Rectangle imgRect = header.ImageBounds;
             imgRect.Width = header.ImageBounds.Height * img.Width / img.Height;
             imgRect.X     = header.ImageBounds.X + header.ImageBounds.Width - imgRect.Width;
             e.Graphics.DrawImage(img, imgRect);
             e.Handled = true;
         }
     }
     #endregion #CustomDrawDayHeader
 }
        private int CountAppointmentsByCriteria(SchedulerHeader rh, TimeInterval visTime)
        {
            AppointmentBaseCollection col = schedulerControl1.ActiveView.GetAppointments().FindAll(delegate(Appointment apt) { return((apt.ResourceIds.Contains(rh.Resource.Id) || (Object.Equals(apt.ResourceId, ResourceEmpty.Id))) && (visTime.Contains(new TimeInterval(apt.Start, apt.End)))); });

            return(col.Count);
        }