コード例 #1
0
        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;
            }
        }
コード例 #2
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;
                }
            }
        }
        private void schedulerControl1_CustomDrawTimeCell(object sender, DevExpress.XtraScheduler.CustomDrawObjectEventArgs e)
        {
            SchedulerViewCellBase cell = (SchedulerViewCellBase)e.ObjectInfo;
            bool  isOddMonth           = hijriCalHelper.IsOddHijriMonths(cell.Interval);
            Color color = isOddMonth ? Color.White : Color.LightSteelBlue;

            cell.Appearance.BackColor = color;
        }
コード例 #4
0
        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;
            }
        }
コード例 #5
0
        private void toolTipController1_BeforeShow(object sender, ToolTipControllerShowEventArgs e)
        {
            ToolTipController     controller = sender as ToolTipController;
            SchedulerViewCellBase cell       = controller.ActiveObject as SchedulerViewCellBase;

            if (cell != null)
            {
                e.ToolTip = cell.Interval.ToString();
            }
        }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
ファイル: WorkCalenderForm.cs プロジェクト: aehyok/ServerMeta
        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;
                }
            }
        }
 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;
         }
     }
 }