Пример #1
0
 private void DrawWeekNumbers(Graphics g, MonthLayout layout, int monthIndex)
 {
     if (this.m_layout.ShowWeekNumbers)
     {
         if (!this.m_useGradient)
         {
             g.FillRectangle(this.m_brushWeekLettersBack, layout.X, layout.InnerBounds.Top, this.m_layout.WeekNumbersWidth, layout.InnerBounds.Height);
         }
         int monthCount = this.m_monthCount;
         for (int i = 0; i < 6; i++)
         {
             DateTime day = this.GetDay(monthIndex, (i * 7) + 6);
             if (day == DateTime.MinValue)
             {
                 day = this.GetDay(monthIndex, i * 7);
                 if (day == DateTime.MinValue)
                 {
                     goto Label_01EE;
                 }
                 day = day.AddDays(6.0);
             }
             int num3 = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(day, this.CalendarWeekRule, this.GetFirstDayOfWeek());
             bool flag = num3 < 10;
             string text = (flag ? "0" : "") + num3.ToString();
             Size size = g.MeasureString(text, base.Font).ToSize();
             Point point = new Point(layout.X + ((this.m_layout.WeekNumbersWidth - size.Width) / 2), layout.GetCellBounds((i * 7) + 6).Top + ((layout.GetCellBounds((i * 7) + 6).Height - size.Height) / 2));
             int num4 = (((this.m_curMonth - 1) + monthIndex) % 12) + 1;
             int month = day.AddDays(-6.0).Month;
             g.DrawString(text, base.Font, (((month < num4) && (monthIndex == 0)) || ((month > num4) && (monthIndex == (monthCount - 1)))) ? this.m_brushOther : this.m_brushCur, (float) point.X, (float) point.Y);
             if (flag)
             {
                 g.DrawString("0", base.Font, this.m_brushWeekLettersBack, (float) point.X, (float) point.Y);
             }
         Label_01EE:;
         }
     }
 }
Пример #2
0
 private void DrawDaysGrid(Graphics g, MonthLayout layout)
 {
     if (this.DaysGrid)
     {
         int cellCountX = layout.CellCountX;
         int cellCountY = layout.CellCountY;
         int num3 = (int) Math.Ceiling(((double) cellCountX) / 2.0);
         int num4 = (int) Math.Ceiling(((double) cellCountY) / 2.0);
         for (int i = 0; i < num3; i++)
         {
             g.DrawRectangle(this.m_penDaysGrid, layout.GetCellBounds(i * 2).X, layout.InnerBounds.Y, layout.GetCellBounds(i * 2).Width - 1, layout.InnerBounds.Height);
         }
         for (int j = 0; j < num4; j++)
         {
             g.DrawRectangle(this.m_penDaysGrid, layout.InnerBounds.X, layout.GetCellBounds((j * 2) * 7).Y, layout.InnerBounds.Width, layout.GetCellBounds((j * 2) * 7).Height - 1);
         }
         g.DrawRectangle(this.m_penDaysGrid, layout.InnerBounds);
     }
 }
Пример #3
0
 private void DrawWeekLetters(Graphics g, MonthLayout layout)
 {
     if (this.m_layout.ShowWeekLetters)
     {
         string weekDayNames = this.GetWeekDayNames();
         if (!this.m_useGradient)
         {
             g.FillRectangle(this.m_brushWeekLettersBack, layout.MonthCaptionBounds.Left, layout.MonthCaptionBounds.Bottom, layout.Width, this.m_layout.WeekLettersHeight);
         }
         for (int i = 0; i < 7; i++)
         {
             int length = weekDayNames.Length / 7;
             string str2 = weekDayNames.Substring(i * length, length);
             Size size = g.MeasureString(str2.ToString(), this.m_fontWeekLetters).ToSize();
             Point point = new Point(layout.GetCellBounds(i).Left + ((layout.GetCellBounds(i).Width - size.Width) / 2), layout.MonthCaptionBounds.Bottom + ((this.m_layout.WeekLettersHeight - size.Height) / 2));
             DayOfWeek week = (DayOfWeek)((i + (int)this.GetFirstDayOfWeek()) % 7);
             g.DrawString(str2.ToString(), this.m_fontWeekLetters, (week == DayOfWeek.Saturday) ? ((this.m_brushWeekLettersSaturday.Color == Color.Transparent) ? this.m_brushWeekLettersText : this.m_brushWeekLettersSaturday) : ((week == DayOfWeek.Sunday) ? ((this.m_brushWeekLettersSunday.Color == Color.Transparent) ? this.m_brushWeekLettersText : this.m_brushWeekLettersSunday) : this.m_brushWeekLettersText), (float) point.X, (float) point.Y);
         }
     }
 }
Пример #4
0
 private void DrawDays(Graphics g, MonthLayout layout, int monthIndex)
 {
     int num = 0x2a;
     for (int i = 0; i < num; i++)
     {
         DateTime day = this.GetDay(monthIndex, i);
         this.DrawDay(g, this.GetDay(monthIndex, i), (day.Date == this.m_curSel.Date) && !this.m_isNone, false, false, layout.GetCellBounds(i), monthIndex, i);
     }
 }