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 schedulerControl1_CustomDrawTimeCell(object sender, CustomDrawObjectEventArgs e) { //TimeCell tc = e.ObjectInfo as TimeCell; //if(tc.Interval.Contains(DateTime.Now)) { // tc.Appearance.BackColor = Color.Red; //} }
private void dayViewTimeCells1_CustomDrawAppointment(object sender, CustomDrawObjectEventArgs e) { AppointmentViewInfo vi = (AppointmentViewInfo)e.ObjectInfo; // The DevExpress.XtraScheduler.Native.RectUtils is a helper object for managing rectangles. Rectangle imgRect = DevExpress.XtraScheduler.Native.RectUtils.CutFromLeft(vi.InnerBounds, vi.InnerBounds.Width - 18); imgRect = DevExpress.XtraScheduler.Native.RectUtils.AlignRectangle(new Rectangle(0, 0, 16, 16), imgRect, ContentAlignment.MiddleCenter); // carUsageImages is a collecion of images (DevExpress.Utils.ImageCollection) created from application resources. e.Cache.Paint.DrawImage(e.Graphics, carUsageImages.Images[Convert.ToInt32(vi.Appointment.StatusKey)], imgRect); Rectangle textRect = DevExpress.XtraScheduler.Native.RectUtils.CutFromRight(vi.InnerBounds, 18); using (StringFormat sf = new StringFormat()) { Brush brush = e.Cache.GetSolidBrush(vi.Appearance.ForeColor); Font fntBold = e.Cache.GetFont(vi.Appearance.Font, FontStyle.Bold); Font fntItalic = e.Cache.GetFont(vi.Appearance.Font, FontStyle.Italic); if (vi.Appointment.LongerThanADay) { Rectangle[] rowRects = DevExpress.XtraScheduler.Native.RectUtils.SplitHorizontally(textRect, 2); string hours = String.Format(" [{0:F2} h]", vi.AppointmentInterval.Duration.TotalHours); e.Cache.DrawString(vi.DisplayText + hours, fntBold, brush, textRect, sf); } else { Rectangle[] rects = DevExpress.XtraScheduler.Native.RectUtils.SplitVertically(textRect, 3); e.Cache.DrawString(vi.Interval.Start.ToShortTimeString() + " " + vi.Interval.End.ToShortTimeString(), vi.Appearance.Font, brush, rects[0], sf); e.Cache.DrawString(String.Format("{0}", vi.Appointment.Subject), fntBold, brush, rects[1], sf); e.Cache.DrawString(vi.Description, fntItalic, brush, rects[2], sf); } } 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; }
/// <summary> /// Evento para posionar a imagem do colaborador no centro do Appointment e o nome do mesmo embaixo da foto /// </summary> /// <param name="sender">object</param> /// <param name="e">CustomDrawObjectEventArgs</param> private void schedulerControl1_CustomDrawAppointment(object sender, CustomDrawObjectEventArgs e) { TimeLineAppointmentViewInfo time = e.ObjectInfo as TimeLineAppointmentViewInfo; if (time != null) { Image image = FotosColaboradores[new Guid(time.Appointment.Id.ToString())]; int width = time.InnerBounds.Width; int x = time.InnerBounds.X; e.Cache.Paint.DrawImage(e.Graphics, image, new Point(x + (width / 2) - (image.Width / 2), time.InnerBounds.Top)); string textColaborador = time.Appointment.Subject; if (FonteAppointment.Size >= 9) { if (textColaborador.Length > 15) { retanguloAppointment.X = x + (width / 2) - (image.Width) - textColaborador.Length - 14; } else { retanguloAppointment.X = x + (width / 2) - (image.Width) - textColaborador.Length + 3; } } else { textColaborador = textColaborador.Replace(" ", "\n"); } retanguloAppointment.X = x + (width / 2) - (image.Width / 2); retanguloAppointment.Y = time.InnerBounds.Top + image.Height + 5; e.Cache.DrawString(textColaborador, FonteAppointment, new SolidBrush(Color.Black), retanguloAppointment, StringFormat.GenericDefault); e.Handled = true; } }
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 schedulerControl1_CustomDrawTimeCell(object sender, CustomDrawObjectEventArgs e) { if (e.ObjectInfo is TimeCell cell) { cell.Selected = false; } }
private void schedulerControl1_CustomDrawTimeCell(object sender, CustomDrawObjectEventArgs e) { HatchBrush brickBrush = new HatchBrush(HatchStyle.DiagonalBrick, Color.LightYellow, Color.Firebrick); Brush solidBrush = new SolidBrush(Color.Plum); SelectableIntervalViewInfo cells = e.ObjectInfo as SelectableIntervalViewInfo; if (cells != null) { if (cells.Selected) { e.Graphics.FillRectangle(solidBrush, e.Bounds); e.Handled = true; } else if (cells.Interval.Start.Day == 13) { e.Graphics.FillRectangle(brickBrush, e.Bounds); e.Handled = true; } } SchedulerViewCellBase cell = e.ObjectInfo as SchedulerViewCellBase; if (cell != null && IsHoliday(cell.Interval)) { cell.Appearance.BackColor = Color.Tomato; } }
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; }
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; }
private void schedulerControl1_CustomDrawTimeCell(object sender, CustomDrawObjectEventArgs e) { SchedulerViewCellBase cell = e.ObjectInfo as SchedulerViewCellBase; if (cell != null && IsHoliday(cell.Interval)) { cell.Appearance.BackColor = Color.Tomato; } }
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 schedulerControl1_CustomDrawDayHeader(object sender, CustomDrawObjectEventArgs e) { DayHeader dh = e.ObjectInfo as DayHeader; if (dh != null) { TimeInterval visTime = dh.Interval; int appointments_Count = CountAppointmentsByCriteria(dh, visTime); dh.Caption = String.Format("{0:MMM dd} has {1} apts", dh.Interval.Start.Date, appointments_Count); } }
private void schedulerControl1_CustomDrawResourceHeader(object sender, CustomDrawObjectEventArgs e) { ResourceHeader rh = e.ObjectInfo as ResourceHeader; if (rh != null) { TimeInterval visTime = schedulerControl1.ActiveView.GetVisibleIntervals().Interval; int appointments_Count = CountAppointmentsByCriteria(rh, visTime); rh.Caption = rh.Resource.Caption + " has " + appointments_Count.ToString() + " apts"; } }
private static void DrawCellInfo(CustomDrawObjectEventArgs e) { string s = e.ObjectInfo.GetType().ToString().Substring("DevExpress.XtraScheduler.Drawing.".Length); SchedulerViewCellBase cell = e.ObjectInfo as SchedulerViewCellBase; if (cell != null) { StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; e.Cache.DrawString(s, new Font("Tahoma", 10), SystemBrushes.GrayText, cell.Bounds, sf); } }
private void dayViewTimeRuler1_CustomDrawDayViewTimeRuler(object sender, CustomDrawObjectEventArgs e) { e.Cache.FillRectangle(e.Cache.GetSolidBrush(Color.LightYellow), e.Bounds); using (StringFormat sf = new StringFormat()) { sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; e.Cache.DrawVString(TimeZoneInfo.Local.DisplayName, e.Cache.GetFont(new Font(Font.FontFamily, 20, FontStyle.Bold), FontStyle.Bold), e.Cache.GetSolidBrush(Color.Gray), e.Bounds, sf, -90); 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 horizontalDateHeaders1_CustomDrawDayHeader(object sender, CustomDrawObjectEventArgs e) { DayHeader header = (DayHeader)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_CustomDrawAppointment(object sender, CustomDrawObjectEventArgs e) { if (((SchedulerControl)sender).ActiveView is DayView) { AppointmentViewInfo viewInfo = e.ObjectInfo as AppointmentViewInfo; // Get DevExpress images. Image im = DevExpress.Images.ImageResourceCache.Default.GetImage("images/actions/add_16x16.png"); Rectangle imageBounds = new Rectangle(viewInfo.InnerBounds.X, viewInfo.InnerBounds.Y, im.Width, im.Height); Rectangle mainContentBounds = new Rectangle(viewInfo.InnerBounds.X, viewInfo.InnerBounds.Y + im.Width + 1, viewInfo.InnerBounds.Width, viewInfo.InnerBounds.Height - im.Height - 1); // Draw image in the appointment. e.Cache.DrawImage(im, imageBounds); int statusDelta = 0; for (int i = 0; i < viewInfo.StatusItems.Count; i++) { AppointmentViewInfoStatusItem statusItem = viewInfo.StatusItems[i] as AppointmentViewInfoStatusItem; // Fill the status bar. e.Cache.FillRectangle(statusItem.BackgroundViewInfo.Brush, statusItem.BackgroundViewInfo.Bounds); e.Cache.FillRectangle(statusItem.ForegroundViewInfo.Brush, statusItem.ForegroundViewInfo.Bounds); // Draw the status bar rectangle. using (var _pen = new Pen(statusItem.ForegroundViewInfo.BorderColor)) { e.Cache.DrawRectangle(_pen, statusItem.BackgroundViewInfo.Bounds); e.Cache.DrawRectangle(_pen, statusItem.ForegroundViewInfo.Bounds); } statusDelta = Math.Max(statusDelta, statusItem.Bounds.Width); } // Draw the appointment caption text. e.Cache.DrawString(viewInfo.DisplayText.Trim(), viewInfo.Appearance.Font, viewInfo.Appearance.GetForeBrush(e.Cache), mainContentBounds, StringFormat.GenericDefault); SizeF subjSize = e.Graphics.MeasureString(viewInfo.DisplayText.Trim(), viewInfo.Appearance.Font, mainContentBounds.Width); int lineYposition = (int)subjSize.Height; Rectangle descriptionLocation = new Rectangle(mainContentBounds.X, mainContentBounds.Y + lineYposition, mainContentBounds.Width, mainContentBounds.Height - lineYposition); if (viewInfo.Appointment.Description.Trim() != "") { // Draw the line above the appointment description. e.Cache.DrawLine(viewInfo.Appearance.GetForePen(e.Cache), descriptionLocation.Location, new Point(descriptionLocation.X + descriptionLocation.Width, descriptionLocation.Y)); // Draw the appointment description text. e.Cache.DrawString(viewInfo.Appointment.Description.Trim(), viewInfo.Appearance.Font, viewInfo.Appearance.GetForeBrush(e.Cache), descriptionLocation, StringFormat.GenericTypographic); } e.Handled = true; } }
/// <summary> /// 주단위일 경우 폰트 설정 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void schedulerControl_CustomDrawDayHeader(object sender, CustomDrawObjectEventArgs e) { if (schedulerControl.ActiveViewType.Equals(SchedulerViewType.WorkWeek))//WorkWeek 타입일 경우에만 지정 { DayHeader header = e.ObjectInfo as DayHeader; if (header.Caption.EndsWith("일요일")) //일요일이면 { header.Appearance.HeaderCaption.ForeColor = Color.PaleVioletRed; //빨간색 } else if (header.Caption.EndsWith("토요일")) //토요일이면 { header.Appearance.HeaderCaption.ForeColor = Color.CornflowerBlue; //파란색 } header.Appearance.HeaderCaption.Font = new Font("세스코 R", 9, FontStyle.Bold); //폰트크기 변경 header.ShouldShowToolTip = true; //툴팁은 항상 보이도록함 (없으면 월단위에서 보이지 않음) } }
private void schedulerControl1_CustomDrawTimeCell(object sender, CustomDrawObjectEventArgs e) { SelectableIntervalViewInfo viewInfo = e.ObjectInfo as SelectableIntervalViewInfo; SchedulerViewCellBase cell = e.ObjectInfo as SchedulerViewCellBase; DateTime CurrentDt = viewInfo.Interval.Start; if (viewInfo.Selected) { //e.Cache.FillRectangle(SystemBrushes.Highlight, cell.Bounds); e.Handled = false; } else { if (CheckDateIsWorkDay(CurrentDt)) { Color _ShowColor = Color.LightCyan; if (Convert.ToBoolean(CurrentDt.Month % 2)) { _ShowColor = Color.LightBlue; } FillGradient(e.Cache, cell.Bounds, _ShowColor, _ShowColor, 45); FillGradient(e.Cache, cell.ContentBounds, _ShowColor, _ShowColor, 45); FillGradient(e.Cache, cell.TopBorderBounds, Color.Gray, Color.Gray, 45); FillGradient(e.Cache, cell.RightBorderBounds, Color.Gray, Color.Gray, 45); FillGradient(e.Cache, cell.LeftBorderBounds, Color.Gray, Color.Gray, 45); FillGradient(e.Cache, cell.BottomBorderBounds, Color.Gray, Color.Gray, 45); e.Handled = true; } else { Color _ShowColor = Color.MistyRose; if (Convert.ToBoolean(CurrentDt.Month % 2)) { _ShowColor = Color.PeachPuff; } FillGradient(e.Cache, cell.Bounds, _ShowColor, _ShowColor, 45); FillGradient(e.Cache, cell.ContentBounds, _ShowColor, _ShowColor, 45); FillGradient(e.Cache, cell.TopBorderBounds, Color.Gray, Color.Gray, 45); FillGradient(e.Cache, cell.RightBorderBounds, Color.Gray, Color.Gray, 45); FillGradient(e.Cache, cell.LeftBorderBounds, Color.Gray, Color.Gray, 45); FillGradient(e.Cache, cell.BottomBorderBounds, Color.Gray, Color.Gray, 45); e.Handled = true; } } }
public static void scheduler_CustomDrawDayOfWeekHeader(object sender, CustomDrawObjectEventArgs e) { DayOfWeekHeader header = e.ObjectInfo as DayOfWeekHeader; // Draw the outer rectangle. e.Cache.FillRectangle(new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds, Color.LightGreen, Color.Green, System.Drawing.Drawing2D.LinearGradientMode.Vertical), e.Bounds); Rectangle innerRect = Rectangle.Inflate(e.Bounds, -2, -2); // Draw the inner rectangle. e.Cache.FillRectangle(new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds, Color.Green, Color.LightGreen, System.Drawing.Drawing2D.LinearGradientMode.Vertical), innerRect); // Draw the header caption. e.Cache.DrawString(header.Caption, header.Appearance.HeaderCaption.Font, new SolidBrush(Color.White), innerRect, header.Appearance.HeaderCaption.GetStringFormat()); e.Handled = true; }
private void schedulerControl1_CustomDrawDayHeader(object sender, CustomDrawObjectEventArgs e) { if (e.ObjectInfo is MonthViewTimeCellHeader header) { header.Selected = false; if (_visibleDates.Contains(header.Interval.Start.Date)) { var backBrush = e.Cache.GetSolidBrush(BackgroundColor); e.Graphics.FillRectangle(backBrush, e.Bounds); var appearance = header.CaptionAppearance; var bounds = header.ContentBounds; var textBrush = appearance.GetForeBrush(e.Cache); e.Graphics.DrawString(header.Caption, appearance.Font, textBrush, bounds, appearance.GetStringFormat()); 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 schedulerControl1_CustomDrawResourceHeader(object sender, CustomDrawObjectEventArgs e) { ResourceHeader rh = (ResourceHeader)e.ObjectInfo; StringFormat sf = rh.Appearance.HeaderCaption.TextOptions.GetStringFormat(); string newcaption = rh.Resource.Caption + "\n Total:" + CalcCurrentTotals(rh.Interval, rh.Resource).ToString("C"); if (schedulerControl1.ActiveViewType == SchedulerViewType.Timeline) { e.Cache.DrawVString(newcaption, rh.Appearance.HeaderCaption.Font, Brushes.Black, e.Bounds, sf, 270); } else { e.Cache.DrawString(newcaption, rh.Appearance.HeaderCaption.Font, Brushes.Black, e.Bounds, sf); } e.Handled = true; }
/// <summary> /// 월단위일 경우 폰트 설정 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void schedulerControl_CustomDrawDayOfWeekHeader(object sender, CustomDrawObjectEventArgs e) { DayOfWeekHeader header = e.ObjectInfo as DayOfWeekHeader; if (header.DayOfWeek.Equals(DayOfWeek.Sunday)) //일요일이면 { header.Appearance.HeaderCaption.ForeColor = Color.PaleVioletRed; //빨간색 } else if (header.DayOfWeek.Equals(DayOfWeek.Saturday)) //토요일이면 { header.Appearance.HeaderCaption.ForeColor = Color.CornflowerBlue; //파란색 } else//그 외에는 { header.Appearance.HeaderCaption.ForeColor = Color.Black;//검정색 } header.Appearance.HeaderCaption.Font = new Font("세스코 R", 9, FontStyle.Bold);//폰트크기 변경 header.ShouldShowToolTip = true; }
private void schedulerControl1_CustomDrawDayHeader(object sender, CustomDrawObjectEventArgs e) { DayHeader header = e.ObjectInfo as DayHeader; // Draws the outer rectangle. using (var backBrush = new LinearGradientBrush(e.Bounds, Color.LightBlue, Color.Blue, LinearGradientMode.Vertical)) e.Cache.FillRectangle(backBrush, e.Bounds); Rectangle innerRect = Rectangle.Inflate(e.Bounds, -2, -2); // Draws the inner rectangle. using (var backBrush = new LinearGradientBrush(e.Bounds, Color.Blue, Color.LightSkyBlue, LinearGradientMode.Vertical)) e.Cache.FillRectangle(backBrush, innerRect); // Draws the header's caption. e.Cache.DrawString(header.Caption, header.Appearance.HeaderCaption.Font, Brushes.White, innerRect, header.Appearance.HeaderCaption.GetStringFormat()); 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; }
private static void scheduler_CustomDrawAppointmentBackground(object sender, CustomDrawObjectEventArgs e) { SchedulerControl scheduler = sender as SchedulerControl; AppointmentViewInfo viewInfo = (e.ObjectInfo as DevExpress.XtraScheduler.Drawing.AppointmentViewInfo); Appointment apt = viewInfo.Appointment; AppointmentBaseCollection allAppointments = scheduler.ActiveView.GetAppointments(); AppointmentConflictsCalculator aCalculator = new AppointmentConflictsCalculator(allAppointments); TimeInterval visibleInterval = scheduler.ActiveView.GetVisibleIntervals().Interval; bool isConflict = aCalculator.CalculateConflicts(apt, visibleInterval).Count != 0; // Paint conflict appointments with a red and white hatch brush. if (isConflict) { Rectangle rect = e.Bounds; Brush brush = e.Cache.GetSolidBrush(scheduler.DataStorage.Appointments.Labels.GetById(apt.LabelKey).GetColor()); e.Cache.FillRectangle(brush, rect); rect.Inflate(-3, -3); using (var _hatchBrush = new HatchBrush(HatchStyle.WideUpwardDiagonal, Color.Red, Color.White)) e.Cache.FillRectangle(_hatchBrush, rect); e.Handled = true; } }
private void schedulerControl1_CustomDrawAppointment(object sender, CustomDrawObjectEventArgs e) { }
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; }
private void schedulerControl1_CustomDrawTimeCell(object sender, CustomDrawObjectEventArgs e) { HatchBrush brickBrush = new HatchBrush(HatchStyle.DiagonalBrick, Color.LightYellow, Color.Firebrick); Brush solidBrush = new SolidBrush(Color.Plum); SelectableIntervalViewInfo cells = e.ObjectInfo as SelectableIntervalViewInfo; if (cells != null) { if (cells.Selected) { e.Graphics.FillRectangle(solidBrush, e.Bounds); e.Handled = true; } else if (cells.Interval.Start.Day == 13) { e.Graphics.FillRectangle(brickBrush, e.Bounds); e.Handled = true; } } SchedulerViewCellBase cell = e.ObjectInfo as SchedulerViewCellBase; if (cell != null && IsHoliday(cell.Interval)) { cell.Appearance.BackColor = Color.Tomato; } }