Example #1
0
        private void schedulerControlPrenotazioni_CustomDrawDayViewAllDayArea(object sender, CustomDrawObjectEventArgs e)
        {
            AllDayAreaCell cell = (AllDayAreaCell)e.ObjectInfo;

            RisultatoCalendario ris = GestoreCalendario.GeneraRichiesta(cell.Interval.Start, m_ActiveControl.Ingresso.CodicePrevent);

            if (ris != null)
            {
                if (!string.IsNullOrEmpty(ris.InfoGiornata))
                {
                    if (cell.Selected)
                    {
                        e.Cache.FillRectangle(Brushes.LightCyan, e.Bounds);
                    }
                    else
                    {
                        e.Cache.FillRectangle(Brushes.Yellow, e.Bounds);
                    }

                    e.Cache.DrawString(ris.InfoGiornata, cell.Appearance.Font, Brushes.Black, e.Bounds, cell.Appearance.TextOptions.GetStringFormat());

                    cell.ToolTipText = String.Format("{0} : {1}", cell.Interval.Start.ToShortDateString(), ris.InfoGiornata);

                    e.Handled = true;
                }
            }
        }
Example #2
0
 private void schedulerControl1_CustomDrawDayViewAllDayArea(object sender, DevExpress.XtraScheduler.CustomDrawObjectEventArgs e)
 {
     if (schedulerStorage1.Appointments != null)
     {
         AllDayAreaCell            cell     = (AllDayAreaCell)e.ObjectInfo;
         Resource                  resource = cell.Resource;
         TimeInterval              interval = cell.Interval;
         AppointmentBaseCollection apts     = ((SchedulerControl)sender).Storage.GetAppointments(interval);
         float percent = CalcCurrentWorkTimeLoad(apts, interval, resource);
         Brush brush;
         if (percent == 0.0)
         {
             brush = Brushes.LightYellow;
         }
         else if (percent < 0.5)
         {
             brush = Brushes.LightBlue;
         }
         else
         {
             brush = Brushes.LightCoral;
         }
         e.Cache.FillRectangle(brush, e.Bounds);
         e.Cache.DrawString(string.Format("{0:P}", percent), cell.Appearance.Font, Brushes.Black, e.Bounds, cell.Appearance.TextOptions.GetStringFormat());
         e.Handled = true;
     }
 }
Example #3
0
        public static void scheduler_CustomDrawDayViewAllDayArea(object sender, DevExpress.XtraScheduler.CustomDrawObjectEventArgs e)
        {
            AllDayAreaCell            cell     = (AllDayAreaCell)e.ObjectInfo;
            Resource                  resource = cell.Resource;
            TimeInterval              interval = cell.Interval;
            AppointmentBaseCollection apts     = ((SchedulerControl)sender).Storage.GetAppointments(interval);
            // Specify what precentage of the appointment duration should be painted.
            float percent = CalcCurrentWorkTimeLoad(apts, interval, resource);
            Brush brush;

            // Select the brush color.
            if (percent == 0.0)
            {
                brush = Brushes.LightYellow;
            }
            else if (percent < 0.5)
            {
                brush = Brushes.LightBlue;
            }
            else
            {
                brush = Brushes.LightCoral;
            }
            // Paint the area with the selected color.
            e.Cache.FillRectangle(brush, e.Bounds);
            // Draw the percentage text.
            StringFormat format = new StringFormat();

            format.LineAlignment = StringAlignment.Center;
            format.Alignment     = StringAlignment.Center;
            e.Cache.DrawString(string.Format("{0:P}", percent), cell.Appearance.Font, Brushes.Black, e.Bounds, format);
            e.Handled = true;
        }
Example #4
0
        private void dayViewTimeCells1_CustomDrawDayViewAllDayArea(object sender, CustomDrawObjectEventArgs e)
        {
            AllDayAreaCell       cell   = (AllDayAreaCell)e.ObjectInfo;
            SchedulerColorSchema schema = this.GetResourceColorSchema(cell.Resource);

            cell.Appearance.BackColor  = schema.Cell;
            cell.Appearance.BackColor2 = schema.CellBorder;
        }