private void schedulerControl1_CustomDrawTimeCell(object sender, CustomDrawObjectEventArgs e) { SelectableIntervalViewInfo obj = e.ObjectInfo as SelectableIntervalViewInfo; if (obj != null) { e.DrawDefault(); if (obj.Resource.Id is Guid) { Ingresso ingresso = obj.Resource.GetSourceObject(this.schedulerStorage1) as Ingresso; if (ingresso != null && ingresso.VerificaCalendario) { if (calendario == null) { calendario = new XPCollection <IngressoCalendario>(this.session1); } int numero = 0; if (Trova(ingresso, obj.Interval.Start, out numero)) { e.Graphics.DrawString(numero.ToString(), font, brush_green, e.Bounds); } } } e.Handled = true; } }
private void dayViewTimeCells1_CustomDrawTimeCell(object sender, CustomDrawObjectEventArgs e) { TimeCell cell = (TimeCell)e.ObjectInfo; Rectangle rect = e.Bounds; rect.Height = 1; rect.Offset(0, rect.Height - 1); e.Cache.DrawRectangle(Pens.Gray, rect); if (cell is ExtendedCell) { SchedulerColorSchema schema = this.GetResourceColorSchema(cell.Resource); cell.Appearance.BackColor = Color.White; cell.Appearance.BackColor2 = schema.CellLight; e.DrawDefault(); } else { using (StringFormat sf = new StringFormat()) { sf.Alignment = StringAlignment.Far; rect = cell.Bounds; rect.Inflate(-10, 0); e.Cache.DrawString(cell.Interval.Start.ToShortTimeString(), e.Cache.GetFont(cell.Appearance.Font, FontStyle.Regular), e.Cache.GetSolidBrush(Color.Gray), rect, sf); } } e.Handled = true; }
private void Scheduler_CustomDrawAppointmentBackground(object sender, CustomDrawObjectEventArgs e) { AppointmentViewInfo aptViewInfo = e.ObjectInfo as AppointmentViewInfo; if (aptViewInfo == null) { return; } if (EventList.CurrentEvent == null) { return; } if ((Guid)aptViewInfo.Appointment.CustomFields["event_id"] == EventList.CurrentEvent.EventId) { Rectangle r = e.Bounds; Brush br = e.Cache.GetSolidBrush(Color.LightPink); using (Region rgn = new Region(Utils.CreateRoundedRectPath(r, 5))) { e.Graphics.FillRegion(br, rgn); } r.Inflate(-5, -5); br = e.Cache.GetSolidBrush(aptViewInfo.Appearance.BackColor); using (Region rgn = new Region(Utils.CreateRoundedRectPath(r, 5))) { e.Graphics.FillRegion(br, rgn); } } else { e.DrawDefault(); } e.Handled = true; }
static void scheduler_CustomDrawAppointment(object sender, CustomDrawObjectEventArgs e) { DevExpress.XtraScheduler.Drawing.AgendaAppointmentViewInfo agendaViewInfo = e.ObjectInfo as DevExpress.XtraScheduler.Drawing.AgendaAppointmentViewInfo; if (agendaViewInfo != null && agendaViewInfo.Selected) { e.DrawDefault(); e.Cache.DrawRectangle(Pens.Black, e.Bounds); e.Handled = true; } }
private void dayViewTimeCells1_CustomDrawAppointmentBackground(object sender, CustomDrawObjectEventArgs e) { e.DrawDefault(); AppointmentViewInfo vi = (AppointmentViewInfo)e.ObjectInfo; Rectangle rect = vi.Bounds; rect.Inflate(-vi.LeftBorderBounds.Width, -vi.TopBorderBounds.Height); Brush brush = e.Cache.GetGradientBrush(rect, Color.White, vi.Appearance.BackColor, System.Drawing.Drawing2D.LinearGradientMode.Vertical); e.Cache.FillRectangle(brush, rect); e.Handled = true; }
private void OnDrawAppointmentBackground(object sender, CustomDrawObjectEventArgs e) { AppointmentViewInfo viewInfo = e.ObjectInfo as AppointmentViewInfo; if (viewInfo != null) { Color color = Color.Black; try { switch ((Model.Appointment.ItemCode)viewInfo.Appointment.CustomFields["ItemType"]) { case Model.Appointment.ItemCode.Appointment: color = Color.FromArgb(0xF7, 0xB4, 0x7F); break; case Model.Appointment.ItemCode.Meeting: color = Color.FromArgb(0xB3, 0xD4, 0x97); break; case Model.Appointment.ItemCode.Event: color = Color.FromArgb(0x8B, 0x9E, 0xBF); break; case Model.Appointment.ItemCode.Task: color = Color.FromArgb(0xD7, 0xE2, 0xF3); break; case Model.Appointment.ItemCode.Project: color = Color.FromArgb(0xBE, 0x86, 0xA1); break; default: return; } } catch { color = Color.FromArgb(0xF7, 0xB4, 0x7F); } Rectangle r = e.Bounds; if (viewInfo.Selected) { e.DrawDefault(); r.Inflate(-2, -2); } Brush br = e.Cache.GetSolidBrush(color); e.Graphics.FillRectangle(br, r); e.Handled = true; } }
private void horizontalResourceHeaders1_CustomDrawResourceHeader(object sender, CustomDrawObjectEventArgs e) { ResourceHeader header = (ResourceHeader)e.ObjectInfo; SchedulerColorSchema schema = this.GetResourceColorSchema(header.Resource); header.Appearance.HeaderCaption.BackColor = schema.CellLight; header.Appearance.HeaderCaption.BackColor2 = schema.Cell; Color color = schema.CellBorderDark; header.Appearance.HeaderCaption.ForeColor = TransformColor(color, 0.6); header.Appearance.HeaderCaption.Font = e.Cache.GetFont(header.Appearance.HeaderCaption.Font, FontStyle.Bold); e.DrawDefault(); e.Handled = true; }
public static void scheduler_CustomDrawAppointmentBackground(object sender, CustomDrawObjectEventArgs e) { AppointmentViewInfo viewInfo = e.ObjectInfo as AppointmentViewInfo; // Specify the ratio of a completed task to the entire task. double completenessRatio = 0.25 * ((int)(viewInfo.Appointment.ResourceId) % 4); // Draw an appointment as usual. e.DrawDefault(); // Draw a background rectangle. Rectangle bounds = CalculateEntireAppointmentBounds(viewInfo); DrawBackGroundCore(e.Cache, bounds, completenessRatio); // Indicate that no default drawing is required. e.Handled = true; }
public static void scheduler_CustomDrawAppointmentBackground_1(object sender, CustomDrawObjectEventArgs e) { AppointmentViewInfo aptViewInfo = e.ObjectInfo as AppointmentViewInfo; if (aptViewInfo == null) { return; } if (aptViewInfo.Selected) { e.DrawDefault(); Rectangle r = e.Bounds; using (var _pen = new Pen(Color.Lime, 4)) e.Cache.DrawRectangle(_pen, r); e.Handled = true; } }
public static void scheduler_CustomDrawAppointmentBackground_3(object sender, CustomDrawObjectEventArgs e) { AppointmentViewInfo aptViewInfo = e.ObjectInfo as AppointmentViewInfo; if (aptViewInfo == null) { return; } if (aptViewInfo.Selected) { e.DrawDefault(); Rectangle r = e.Bounds; Brush brRect = aptViewInfo.Status.GetBrush(); e.Graphics.DrawRectangle(new Pen(Color.Lime, 4), r); e.Handled = true; } }
public static void scheduler_CustomDrawTimeCell_01(object sender, CustomDrawObjectEventArgs e) { e.DrawDefault(); HorizontalSingleWeekCell cell = e.ObjectInfo as HorizontalSingleWeekCell; if (cell != null) { StringFormat sf = new StringFormat(); sf.LineAlignment = StringAlignment.Center; e.Cache.DrawRectangle(SystemPens.ActiveBorder, cell.Bounds); if (cell.FirstVisible) { e.Cache.DrawString("First Visible Cell", new Font("Tahoma", 8), Brushes.Blue, cell.Bounds, sf); } } e.Handled = true; }
private void timelineCells1_CustomDrawAppointmentBackground(object sender, CustomDrawObjectEventArgs e) { e.DrawDefault(); AppointmentViewInfo vi = (AppointmentViewInfo)e.ObjectInfo; Appointment apt = vi.Appointment; Assignment ass = apt.GetSourceObject(this.schedulerControlPrintAdapter1.SchedulerControl.Storage) as Assignment; //vi.Appearance.BackColor = Color.FromArgb(ass.Booking.Color); Rectangle rect = vi.Bounds; rect.Inflate(-vi.LeftBorderBounds.Width, -vi.TopBorderBounds.Height); Brush brush = e.Cache.GetGradientBrush(rect, Color.FromArgb(ass.Booking.Color), Color.FromArgb(ass.Booking.Color), LinearGradientMode.Vertical); e.Cache.FillRectangle(brush, rect); // e.Handled = true; e.Handled = ass.Booking.ColorBookings; }
void schedulerControl_CustomDrawAppointmentBackground(object sender, CustomDrawObjectEventArgs e) { SchedulerControl schedulerControl = sender as SchedulerControl; AppointmentViewInfo info = e.ObjectInfo as AppointmentViewInfo; string tabResourceName = (schedulerControl.Parent as XtraTabPage).Text; string appointmentResourceName = String.Empty; if (!(info.Appointment.ResourceId is EmptyResourceId)) { appointmentResourceName = schedulerStorage.Resources[(int)info.Appointment.ResourceId].Caption; } e.DrawDefault(); if (appointmentResourceName != tabResourceName) { Color color = schedulerStorage.Appointments.Labels.GetById(info.Appointment.LabelKey).Color; Color lightColor = ControlPaint.LightLight(color); Rectangle rect = new Rectangle(e.Bounds.X + 2, e.Bounds.Y + 2, e.Bounds.Width - 4, e.Bounds.Height - 4); e.Graphics.FillRectangle(new SolidBrush(lightColor), rect); } e.Handled = true; }
private void Draw(CustomDrawObjectEventArgs e, SolidBrush brush, ref Rectangle topBounds, ref Rectangle bottomBounds, List <Rectangle> secondaryBounds, ref Rectangle generalBounds) { Region clip = e.Graphics.Clip; e.DrawDefault(); Region newClip = new Region(generalBounds); e.Graphics.Clip = newClip; e.Graphics.FillRectangle(brush, topBounds); e.Graphics.DrawLines(new Pen(Color.Black, 1), new Point[] { new Point(topBounds.X, topBounds.Y + topBounds.Height - 1), new Point(topBounds.X, topBounds.Y), new Point(topBounds.X + topBounds.Width - 1, topBounds.Y), new Point(topBounds.X + topBounds.Width - 1, topBounds.Y + topBounds.Height - 1) }); foreach (Rectangle r in secondaryBounds) { e.Graphics.FillRectangle(brush, r); e.Graphics.DrawLines(new Pen(Color.Black, 1), new Point[] { new Point(r.X, r.Y), new Point(r.X, r.Y + r.Height - 1) }); e.Graphics.DrawLines(new Pen(Color.Black, 1), new Point[] { new Point(r.X + r.Width - 1, r.Y), new Point(r.X + r.Width - 1, r.Y + r.Height - 1) }); } e.Graphics.FillRectangle(brush, bottomBounds); e.Graphics.DrawLines(new Pen(Color.Black, 1), new Point[] { new Point(bottomBounds.X, bottomBounds.Y), new Point(bottomBounds.X, bottomBounds.Y + bottomBounds.Height - 1), new Point(bottomBounds.X + bottomBounds.Width - 1, bottomBounds.Y + bottomBounds.Height - 1), new Point(bottomBounds.X + bottomBounds.Width - 1, bottomBounds.Y) }); e.Graphics.Clip = clip; e.Handled = true; }
private void schedulerControlPrenotazioni_CustomDrawTimeCell(object sender, CustomDrawObjectEventArgs e) { SelectableIntervalViewInfo obj = e.ObjectInfo as DevExpress.XtraScheduler.Drawing.SelectableIntervalViewInfo; if (obj != null) { e.DrawDefault(); if (m_ActiveControl != null && m_ActiveControl.Ingresso.CodicePrevent > 0 && m_ActiveControl.Ingresso.Prenotazione != EnumPrenotazioneIngresso.NonGestita) { RisultatoCalendario ris = GestoreCalendario.GeneraRichiesta(obj.Interval.Start, m_ActiveControl.Ingresso.CodicePrevent); if (ris != null) { int numero = ris.PostiDisponibili; if (obj.Selected) { e.Graphics.DrawString(numero.ToString(), font, brush_white, e.Bounds); } else { e.Graphics.DrawString(numero.ToString(), font, brush_green, e.Bounds); } if (numero > 0) { // int massimo = Math.Max(numero, m_ActiveControl.Ingresso.CapacitaSlot(GestoreCalendario.TipoGS)); int massimo = Math.Max(numero, ris.MaxPostiDisponibili); e.Graphics.DrawLine(pen_green, e.Bounds.X + 1, e.Bounds.Y + 16, e.Bounds.X + e.Bounds.Width * numero / massimo - 1, e.Bounds.Y + 16); } } } 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; }
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 void scheduler_CustomDrawDayHeader(object sender, CustomDrawObjectEventArgs e) { e.DrawDefault(); if (schedulerControl1.ActiveViewType == SchedulerViewType.Month) { DayHeader header = e.ObjectInfo as DayHeader; var vcal = new ConvertSolarToLunar(); int[] arr = vcal.convertSolar2Lunars(header.Interval.Start.Day, header.Interval.Start.Month, header.Interval.Start.Year, 7); var tempDay = arr[0] + "/" + arr[1]; string lunnarDay; if (arr[0].ToString() == "1") { lunnarDay = arr[0] + "/" + arr[1]; } else { lunnarDay = arr[0].ToString(); } bool holiday = false; if (tempDay == "10/3") { lunnarDay = "Giỗ Tổ Hùng Vương"; holiday = true; } else if (tempDay == "5/5") { lunnarDay = "Tết Đoan Ngọ"; holiday = true; } else if (tempDay == "1/1") { lunnarDay = "Mùng 1 Tết"; holiday = true; } else if (tempDay == "2/1") { lunnarDay = "Mùng 2 Tết"; holiday = true; } else if (tempDay == "3/1") { lunnarDay = "Mùng 3 Tết"; holiday = true; } else if (tempDay == "4/1") { lunnarDay = "Mùng 4 Tết"; holiday = true; } else if (header.Interval.Start.Day == 1 && header.Interval.Start.Month == 1) { lunnarDay = "Tết Dương Lịch"; holiday = true; } else if (header.Interval.Start.Day == 30 && header.Interval.Start.Month == 4) { lunnarDay = "Giải Phóng Miền Nam"; holiday = true; } else if (header.Interval.Start.Day == 1 && header.Interval.Start.Month == 5) { lunnarDay = "Quốc Tế Lao Động"; holiday = true; } else if (header.Interval.Start.Day == 2 && header.Interval.Start.Month == 9) { lunnarDay = "Lễ Quốc Khánh"; holiday = true; } //header.Image = Image.FromFile("vietnam.png"); StringFormat format = new StringFormat { Alignment = StringAlignment.Far, LineAlignment = StringAlignment.Center }; StringFormat format_holiday = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }; StringFormat format2 = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }; //e.DrawDefault(); RectangleF r = e.ObjectInfo.Bounds; string str = string.Format("{0}", lunnarDay); Font font = new Font("Tahoma", 7.0f, FontStyle.Bold); Font font_calendar = new Font("Arial", 12.0f); //header.Caption = string.Empty; e.Graphics.FillRectangle(Brushes.White, header.Bounds); Color color = Color.Gray; if (header.Interval.Start.DayOfWeek == DayOfWeek.Sunday) { color = Color.Red; } else if (header.Interval.Start.DayOfWeek == DayOfWeek.Saturday) { color = Color.Green; } if (arr[0].ToString() == "1" || holiday) { font = new Font("Tahoma", 7.2f, FontStyle.Bold); if (holiday) { e.Graphics.FillRectangle(Brushes.Red, header.Bounds); e.Graphics.DrawString(str, font, new SolidBrush(Color.White), r, format_holiday); } else if (header.Interval.Start.Day == 1) { e.Graphics.DrawString(str, font, new SolidBrush(color), r, format); e.Graphics.DrawString(header.Interval.Start.Day + "", font_calendar, new SolidBrush(color), r, format2); } else if (header.Interval.Start.Day != 1) { e.Graphics.DrawString(str, font, new SolidBrush(color), r, format); e.Graphics.DrawString(header.Interval.Start.Day + "", font_calendar, new SolidBrush(color), r, format2); } } else if (header.Interval.Start.Day != 1) { e.Graphics.DrawString(str, font, new SolidBrush(color), r, format); e.Graphics.DrawString(header.Interval.Start.Day + "", font_calendar, new SolidBrush(color), r, format2); } if (header.Interval.Start.Day == 1 && !holiday) { e.Graphics.DrawString(header.Interval.Start.Day + "/" + header.Interval.Start.Month, font_calendar, new SolidBrush(Color.Red), r, format2); } } e.Handled = true; }
private static void Scheduler_CustomDrawDayViewAllDayArea(object sender, CustomDrawObjectEventArgs e) { e.DrawDefault(); DrawCellInfo(e); e.Handled = true; }
public static void scheduler_CustomDrawTimeCell(object sender, CustomDrawObjectEventArgs e) { e.DrawDefault(); DrawCellInfo(e); e.Handled = true; }
private void Scheduler_CustomDrawAppointmentBackground(object sender, CustomDrawObjectEventArgs e) { AppointmentViewInfo aptViewInfo = e.ObjectInfo as AppointmentViewInfo; if (aptViewInfo == null) return; if (EventList.CurrentEvent == null) return; if ((Guid)aptViewInfo.Appointment.CustomFields["event_id"] == EventList.CurrentEvent.EventId) { Rectangle r = e.Bounds; Brush br = e.Cache.GetSolidBrush(Color.LightPink); using (Region rgn = new Region(Utils.CreateRoundedRectPath(r, 5))) { e.Graphics.FillRegion(br, rgn); } r.Inflate(-5, -5); br = e.Cache.GetSolidBrush(aptViewInfo.Appearance.BackColor); using (Region rgn = new Region(Utils.CreateRoundedRectPath(r, 5))) { e.Graphics.FillRegion(br, rgn); } } else { e.DrawDefault(); } e.Handled = true; }