/// <summary>
        /// Draws a single week header element.
        /// </summary>
        /// <param name="g">The <see cref="Graphics"/> object used to draw.</param>
        /// <param name="week">The <see cref="MonthCalendarWeek"/> to draw.</param>
        public override void DrawWeekHeaderItem(Graphics g, MonthCalendarWeek week)
        {
            if (!CheckParams(g, week.Bounds))
            {
                return;
            }

            var weekString = this.monthCal.UseNativeDigits
            ? DateMethods.GetNativeNumberString(week.WeekNumber, this.monthCal.Culture.NumberFormat.NativeDigits, false)
            : week.WeekNumber.ToString(CultureInfo.CurrentUICulture);

            // draw week header element
            using (StringFormat format = GetStringAlignment(this.monthCal.DayTextAlignment))
            {
                // set alignment
                format.Alignment = StringAlignment.Center;

                // draw string
                using (SolidBrush brush = new SolidBrush(this.ColorTable.WeekHeaderText))
                {
                    if (this.monthCal.Enabled)
                    {
                        g.DrawString(
                            weekString,
                            this.monthCal.Font,
                            brush,
                            week.Bounds,
                            format);
                    }
                    else
                    {
                        ControlPaint.DrawStringDisabled(
                            g,
                            weekString,
                            this.monthCal.Font,
                            Color.Transparent,
                            week.Bounds,
                            format);
                    }
                }
            }
        }
        /// <summary>
        /// Draws a single week header element.
        /// </summary>
        /// <param name="g">The <see cref="Graphics"/> object used to draw.</param>
        /// <param name="week">The <see cref="MonthCalendarWeek"/> to draw.</param>
        public override void DrawWeekHeaderItem(Graphics g, MonthCalendarWeek week)
        {
            if (!CheckParams(g, week.Bounds))
            {
                return;
            }

            // draw week header element
            using (StringFormat format = GetStringAlignment(this.monthCal.DayTextAlignment))
            {
                // set alignment
                format.Alignment = StringAlignment.Center;

                // draw string
                using (SolidBrush brush = new SolidBrush(this.ColorTable.WeekHeaderText))
                {
                    if (this.monthCal.Enabled)
                    {
                        g.DrawString(
                            week.WeekNumber.ToString(),
                            this.monthCal.Font,
                            brush,
                            week.Bounds,
                            format);
                    }
                    else
                    {
                        ControlPaint.DrawStringDisabled(
                            g,
                            week.WeekNumber.ToString(),
                            this.monthCal.Font,
                            Color.Transparent,
                            week.Bounds,
                            format);
                    }
                }
            }
        }
Пример #3
0
 /// <summary>
 /// Draws a single week header element.
 /// </summary>
 /// <param name="g">The <see cref="Graphics"/> object used to draw.</param>
 /// <param name="week">The <see cref="MonthCalendarWeek"/> to draw.</param>
 public abstract void DrawWeekHeaderItem(Graphics g, MonthCalendarWeek week);
 /// <summary>
 /// Draws a single week header element.
 /// </summary>
 /// <param name="g">The <see cref="Graphics"/> object used to draw.</param>
 /// <param name="week">The <see cref="MonthCalendarWeek"/> to draw.</param>
 public abstract void DrawWeekHeaderItem(Graphics g, MonthCalendarWeek week);
Пример #5
0
      /// <summary>
      /// Draws a single week header element.
      /// </summary>
      /// <param name="g">The <see cref="Graphics"/> object used to draw.</param>
      /// <param name="week">The <see cref="MonthCalendarWeek"/> to draw.</param>
      public override void DrawWeekHeaderItem(Graphics g, MonthCalendarWeek week)
      {
         if (!CheckParams(g, week.Bounds))
         {
            return;
         }

         var weekString = this.monthCal.UseNativeDigits
            ? DateMethods.GetNativeNumberString(week.WeekNumber, this.monthCal.Culture.NumberFormat.NativeDigits, false)
            : week.WeekNumber.ToString(CultureInfo.CurrentUICulture);

         // draw week header element
         using (StringFormat format = GetStringAlignment(this.monthCal.DayTextAlignment))
         {
            // set alignment
            format.Alignment = StringAlignment.Center;

            // draw string
            using (SolidBrush brush = new SolidBrush(this.ColorTable.WeekHeaderText))
            {
               if (this.monthCal.Enabled)
               {
                  g.DrawString(
                     weekString,
                     this.monthCal.Font,
                     brush,
                     week.Bounds,
                     format);
               }
               else
               {
                  ControlPaint.DrawStringDisabled(
                     g,
                     weekString,
                     this.monthCal.Font,
                     Color.Transparent,
                     week.Bounds,
                     format);
               }
            }
         }
      }