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);
            }
        }
        public override string GetDayColumnHeaderToolTip(DayHeader header)
        {
            DateTime date = header.Interval.Start.Date;

            if (date.Month == 1 && date.Day == 1)
            {
                return("Let's celebrate!");
            }
            else
            {
                return(base.GetDayColumnHeaderToolTip(header));
            }
        }
        public override string GetDayColumnHeaderCaption(DayHeader header)
        {
            DateTime date = header.Interval.Start.Date;

            if (date.Month == 1 && date.Day == 1)
            {
                return("DayColumnHeader");
            }
            else
            {
                return(base.GetDayColumnHeaderCaption(header));
            }
        }
Пример #4
0
        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;
        }
Пример #5
0
 /// <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;                                 //툴팁은 항상 보이도록함 (없으면 월단위에서 보이지 않음)
     }
 }
Пример #6
0
        public static void scheduler_CustomDrawDayHeader(object sender, CustomDrawObjectEventArgs e)
        {
            DayHeader header = e.ObjectInfo as DayHeader;

            // Draw the outer rectangle.
            e.Cache.FillRectangle(new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds,
                                                                                   Color.LightBlue, Color.Blue, 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.Blue, Color.LightSkyBlue, 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)
        {
            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;
        }
Пример #8
0
        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;
        }