/// <summary> /// Initializes a new instance of the <see cref="NuGenWeeknumber"/> class. /// </summary> public NuGenWeeknumber(NuGenCalendar calendar) { m_calendar = calendar; m_backColor1 = Color.White; m_backColor2 = Color.White; m_gradientMode = NuGenGradientMode.None; m_textColor = Color.FromArgb(0, 84, 227); m_borderColor = Color.Black; m_font = new Font("Microsoft Sans Serif", (float)8.25); m_align = NuGenWeeknumberAlign.Top; }
/// <summary> /// Initializes a new instance of the <see cref="NuGenWeekday"/> class. /// </summary> public NuGenWeekday(NuGenCalendar calendar) { m_calendar = calendar; m_backColor1 = Color.White; m_backColor2 = Color.White; m_gradientMode = NuGenGradientMode.None; m_textColor = Color.FromArgb(0, 84, 227); m_font = new Font("Microsoft Sans Serif", (float)8.25); m_dayFormat = NuGenDayFormat.Short; m_align = StringAlignment.Center; m_borderColor = Color.Black; }
/// <summary> /// Initializes a new instance of the <see cref="NuGenWeekday"/> class. /// </summary> public NuGenWeekday(NuGenCalendar calendar) { m_calendar = calendar; m_backColor1 = Color.White; m_backColor2 = Color.White; m_gradientMode = NuGenGradientMode.None; m_textColor = Color.FromArgb(0, 84, 227); m_font = new Font("Microsoft Sans Serif", (float)8.25); m_dayFormat = NuGenDayFormat.Short; m_align = StringAlignment.Center; m_borderColor = Color.Black; }
/// <summary> /// Initializes a new instance of the <see cref="NuGenDateItem"/> class. /// </summary> public NuGenDateItem() { m_imageIndex = -1; m_backColor1 = Color.Empty; m_backColor2 = Color.White; m_dateColor = Color.Empty; m_textColor = Color.Empty; m_gradientMode = NuGenGradientMode.None; m_text = ""; m_enabled = true; m_bgImage = null; m_pattern = NuGenRecurrence.None; }
/// <summary> /// Initializes a new instance of the <see cref="NuGenFooter"/> class. /// </summary> public NuGenFooter(NuGenCalendar calendar) { m_calendar = calendar; m_backColor1 = Color.White; m_backColor2 = Color.White; m_gradientMode = NuGenGradientMode.None; m_textColor = Color.Black; m_font = new Font("Microsoft Sans Serif", (float)8.25, FontStyle.Bold); m_format = NuGenTodayFormat.Short; m_text = ""; m_showToday = true; m_align = StringAlignment.Near; }
/// <summary> /// Initializes a new instance of the <see cref="NuGenFooter"/> class. /// </summary> public NuGenFooter(NuGenCalendar calendar) { m_calendar = calendar; m_backColor1 = Color.White; m_backColor2 = Color.White; m_gradientMode = NuGenGradientMode.None; m_textColor = Color.Black; m_font = new Font("Microsoft Sans Serif", (float)8.25, FontStyle.Bold); m_format = NuGenTodayFormat.Short; m_text = ""; m_showToday = true; m_align = StringAlignment.Near; }
/// <summary> /// Initializes a new instance of the <see cref="NuGenHeader"/> class. /// </summary> /// <param name="calendar"></param> /// <param name="serviceProvider"> /// <para>Requires:</para> /// <para><see cref="INuGenCalendarRenderer"/></para> /// </param> /// <exception cref="ArgumentNullException"> /// <para> /// <paramref name="calendar"/> is <see langword="null"/>. /// </para> /// -or- /// <para> /// <paramref name="serviceProvider"/> is <see langword="null"/>. /// </para> /// </exception> public NuGenHeader(NuGenCalendar calendar, INuGenServiceProvider serviceProvider) { if (calendar == null) { throw new ArgumentNullException("calendar"); } if (serviceProvider == null) { throw new ArgumentNullException("serviceProvider"); } _calendar = calendar; _serviceProvider = serviceProvider; _backColor1 = Color.FromArgb(0, 84, 227); _backColor2 = Color.White; _gradientMode = NuGenGradientMode.None; _textColor = Color.White; _font = new Font("Microsoft Sans Serif", (float)8.25, FontStyle.Bold); _showMonth = true; _monthSelector = true; _text = ""; _contextMenu = true; _align = StringAlignment.Center; _prevBtnState = HeaderButtonState.Normal; _nextBtnState = HeaderButtonState.Normal; _prevYearBtnState = HeaderButtonState.Normal; _nextYearBtnState = HeaderButtonState.Normal; // create monthContext menu and setup event handlers for (int k = 0; k < 12; k++) { _monthMenu.MenuItems.Add(_monthMenu.MenuItems.Count, new MenuItem("")); _monthMenu.MenuItems[_monthMenu.MenuItems.Count - 1].Click += new EventHandler(MonthContextMenu_Click); } Setup(); }
/// <summary> /// Initializes a new instance of the <see cref="DayColors"/> class. /// </summary> public DayColors(MonthColors parent) { m_parent = parent; m_textColor = Color.Black; m_dateColor = Color.Black; m_backColor1 = Color.White; m_backColor2 = Color.White; m_borderColor = Color.Black; m_gradientMode = NuGenGradientMode.None; }
/// <summary> /// Initializes a new instance of the <see cref="TrailingColors"/> class. /// </summary> public TrailingColors(MonthColors parent) { m_parent = parent; m_textColor = Color.LightGray; m_dateColor = Color.LightGray; m_backColor1 = Color.White; m_backColor2 = Color.White; m_gradientMode = NuGenGradientMode.None; }
/// <summary> /// Initializes a new instance of the <see cref="WeekendColors"/> class. /// </summary> public WeekendColors(MonthColors parent) { m_parent = parent; m_textColor = Color.Black; m_dateColor = Color.Black; m_backColor1 = Color.White; m_backColor2 = Color.White; m_gradientMode = NuGenGradientMode.None; m_saturday = true; m_sunday = true; }
/// <summary> /// Initializes a new instance of the <see cref="DisabledColors"/> class. /// </summary> public DisabledColors(MonthColors parent) { m_parent = parent; m_textColor = Color.LightGray; m_dateColor = Color.LightGray; m_backColor1 = Color.FromArgb(233, 233, 233); m_backColor2 = Color.White; m_gradientMode = NuGenGradientMode.None; }
/// <summary> /// Initializes a new instance of the <see cref="MonthColors"/> class. /// </summary> /// <param name="month">The month.</param> public MonthColors(NuGenMonth month) { m_month = month; m_trailingColors = new TrailingColors(this); m_weekendColors = new WeekendColors(this); m_disabledColors = new DisabledColors(this); m_selectedColors = new SelectedColors(this); m_focusColors = new FocusColors(this); m_dayColors = new DayColors(this); // Default values m_backColor1 = Color.White; m_backColor2 = Color.White; m_gradientMode = NuGenGradientMode.None; }
/// <summary> /// Initializes a new instance of the <see cref="NuGenDateItem"/> class. /// </summary> public NuGenDateItem() { m_imageIndex = -1; m_backColor1 = Color.Empty; m_backColor2 = Color.White; m_dateColor = Color.Empty; m_textColor = Color.Empty; m_gradientMode = NuGenGradientMode.None; m_text = ""; m_enabled = true; m_bgImage = null; m_pattern = NuGenRecurrence.None; }
internal void Draw(Graphics e, NuGenDateItem queryInfo) { StringFormat dateAlign = new StringFormat(); StringFormat textAlign = new StringFormat(); Font boldFont = new Font(m_month.DateFont.Name, m_month.DateFont.Size, m_month.DateFont.Style | FontStyle.Bold); Color bgColor1 = m_month.Colors.Days.BackColor1; Color bgColor2 = m_month.Colors.Days.BackColor2; NuGenGradientMode gradientMode = m_month.Colors.Days.GradientMode; Color textColor = m_month.Colors.Days.Text; Color dateColor = m_month.Colors.Days.Date; Brush dateBrush = new SolidBrush(dateColor); Brush textBrush = new SolidBrush(textColor); Brush bgBrush = new SolidBrush(bgColor1); string dateString; m_imageRect = new Rectangle(); string text = ""; bool drawDay = false; bool enabled = true; Image bgImage = null; int i = -1; bool boldedDate = false; NuGenDateItem[] info; m_dayImage = null; dateAlign = NuGenControlPaint.ContentAlignmentToStringFormat(m_month.DateAlign); textAlign = NuGenControlPaint.ContentAlignmentToStringFormat(m_month.TextAlign); if ((m_month.SelectedMonth.Month == m_date.Month) || (m_month.Calendar.ShowTrailingDates)) { drawDay = true; } if (((m_date.DayOfWeek == DayOfWeek.Saturday) && (m_month.Colors.Weekend.Saturday)) || ((m_date.DayOfWeek == DayOfWeek.Sunday) && (m_month.Colors.Weekend.Sunday))) { bgColor1 = m_month.Colors.Weekend.BackColor1; bgColor2 = m_month.Colors.Weekend.BackColor2; dateColor = m_month.Colors.Weekend.Date; textColor = m_month.Colors.Weekend.Text; gradientMode = m_month.Colors.Weekend.GradientMode; } if (m_month.SelectedMonth.Month != m_date.Month) { bgColor1 = m_month.Colors.Trailing.BackColor1; bgColor2 = m_month.Colors.Trailing.BackColor2; gradientMode = m_month.Colors.Trailing.GradientMode; dateColor = m_month.Colors.Trailing.Date; textColor = m_month.Colors.Trailing.Text; } // Check if formatting should be applied if ((m_month.FormatTrailing) || (m_month.SelectedMonth.Month == m_date.Month)) { // check of there is formatting for this day if (queryInfo != null) { info = new NuGenDateItem[1]; info[0] = queryInfo; } else { info = m_calendar.GetDateInfo(this.Date); } if (info.Length > 0) { i = 0; } // go through the available dateitems while ((i < info.Length) && (drawDay)) { if (info.Length > 0) { NuGenDateItem dateInfo = info[i]; if (dateInfo.BackColor1 != Color.Empty) { bgColor1 = dateInfo.BackColor1; } if (dateInfo.BackColor2 != Color.Empty) { bgColor2 = dateInfo.BackColor2; } gradientMode = dateInfo.GradientMode; if (dateInfo.DateColor != Color.Empty) { dateColor = dateInfo.DateColor; } if (dateInfo.TextColor != Color.Empty) { textColor = dateInfo.TextColor; } text = dateInfo.Text; if (dateInfo.Weekend) { bgColor1 = m_month.Colors.Weekend.BackColor1; bgColor2 = m_month.Colors.Weekend.BackColor2; gradientMode = m_month.Colors.Weekend.GradientMode; dateColor = m_month.Colors.Weekend.Date; textColor = m_month.Colors.Weekend.Text; } boldedDate = dateInfo.BoldedDate; enabled = dateInfo.Enabled; if (!dateInfo.Enabled) { bgColor1 = m_month.Colors.Disabled.BackColor1; bgColor2 = m_month.Colors.Disabled.BackColor2; gradientMode = m_month.Colors.Disabled.GradientMode; dateColor = m_month.Colors.Disabled.Date; textColor = m_month.Colors.Disabled.Text; } m_dayImage = dateInfo.Image; if (m_dayImage != null) { m_imageRect = ImageRect(m_month.ImageAlign); } bgImage = dateInfo.BackgroundImage; } if (m_state == NuGenDayState.Selected) { dateColor = m_month.Colors.Selected.Date; textColor = m_month.Colors.Selected.Text; } if ((m_state == NuGenDayState.Focus) && (m_month.Calendar.ShowFocus)) { dateColor = m_month.Colors.Focus.Date; textColor = m_month.Colors.Focus.Text; } if (bgImage != null) { e.DrawImage(bgImage, m_rect); } else { if (gradientMode == NuGenGradientMode.None) { if (bgColor1 != Color.Transparent) { bgBrush = new SolidBrush(Color.FromArgb(m_month.Transparency.Background, bgColor1)); e.FillRectangle(bgBrush, m_rect); } } else { m_calendar.DrawGradient(e, Rectangle, bgColor1, bgColor2, gradientMode); } } ControlPaint.DrawBorder(e, m_rect, m_month.Colors.Days.Border, m_month.BorderStyles.Normal); if (m_dayImage != null) { if (enabled) { e.DrawImageUnscaled(m_dayImage, m_imageRect); } else { ControlPaint.DrawImageDisabled(e, m_dayImage, m_imageRect.X, m_imageRect.Y, m_month.Colors.Disabled.BackColor1); } } // Check if we should append month name to date if ((m_month.ShowMonthInDay) && ((m_date.AddDays(-1).Month != m_date.Month) || (m_date.AddDays(1).Month != m_date.Month))) { dateString = m_date.Day.ToString() + " " + m_calendar._dateTimeFormat.GetMonthName(m_date.Month); } else { dateString = m_date.Day.ToString(); } if (dateColor != Color.Transparent) { dateBrush = new SolidBrush(Color.FromArgb(m_month.Transparency.Text, dateColor)); CharacterRange[] characterRanges = { new CharacterRange(0, dateString.Length) }; dateAlign.SetMeasurableCharacterRanges(characterRanges); m_dateRgn = new Region[1]; // Should date be bolded ? if (!boldedDate) { e.DrawString(dateString, m_month.DateFont, dateBrush, m_rect, dateAlign); m_dateRgn = e.MeasureCharacterRanges(dateString, m_month.DateFont, m_rect, dateAlign); } else { e.DrawString(dateString, boldFont, dateBrush, m_rect, dateAlign); m_dateRgn = e.MeasureCharacterRanges(dateString, boldFont, m_rect, dateAlign); } } if ((text.Length > 0) && (textColor != Color.Transparent)) { textBrush = new SolidBrush(Color.FromArgb(m_month.Transparency.Text, textColor)); CharacterRange[] characterRanges = { new CharacterRange(0, text.Length) }; textAlign.SetMeasurableCharacterRanges(characterRanges); m_textRgn = new Region[1]; e.DrawString(text, m_month.TextFont, textBrush, m_rect, textAlign); m_textRgn = e.MeasureCharacterRanges(text, m_month.TextFont, m_rect, textAlign); } i++; } } dateBrush.Dispose(); bgBrush.Dispose(); textBrush.Dispose(); boldFont.Dispose(); dateAlign.Dispose(); textAlign.Dispose(); }
/// <summary> /// Initializes a new instance of the <see cref="NuGenHeader"/> class. /// </summary> /// <param name="calendar"></param> /// <param name="serviceProvider"> /// <para>Requires:</para> /// <para><see cref="INuGenCalendarRenderer"/></para> /// </param> /// <exception cref="ArgumentNullException"> /// <para> /// <paramref name="calendar"/> is <see langword="null"/>. /// </para> /// -or- /// <para> /// <paramref name="serviceProvider"/> is <see langword="null"/>. /// </para> /// </exception> public NuGenHeader(NuGenCalendar calendar, INuGenServiceProvider serviceProvider) { if (calendar == null) { throw new ArgumentNullException("calendar"); } if (serviceProvider == null) { throw new ArgumentNullException("serviceProvider"); } _calendar = calendar; _serviceProvider = serviceProvider; _backColor1 = Color.FromArgb(0, 84, 227); _backColor2 = Color.White; _gradientMode = NuGenGradientMode.None; _textColor = Color.White; _font = new Font("Microsoft Sans Serif", (float)8.25, FontStyle.Bold); _showMonth = true; _monthSelector = true; _text = ""; _contextMenu = true; _align = StringAlignment.Center; _prevBtnState = HeaderButtonState.Normal; _nextBtnState = HeaderButtonState.Normal; _prevYearBtnState = HeaderButtonState.Normal; _nextYearBtnState = HeaderButtonState.Normal; // create monthContext menu and setup event handlers for (int k = 0; k < 12; k++) { _monthMenu.MenuItems.Add(_monthMenu.MenuItems.Count, new MenuItem("")); _monthMenu.MenuItems[_monthMenu.MenuItems.Count - 1].Click += new EventHandler(MonthContextMenu_Click); } Setup(); }
internal void DrawGradient(Graphics e, Rectangle rect, Color color1, Color color2, NuGenGradientMode mode) { LinearGradientMode gradient = LinearGradientMode.BackwardDiagonal; if (mode == NuGenGradientMode.Vertical) gradient = LinearGradientMode.Vertical; else if (mode == NuGenGradientMode.Horizontal) gradient = LinearGradientMode.Horizontal; else if (mode == NuGenGradientMode.BackwardDiagonal) gradient = LinearGradientMode.BackwardDiagonal; else if (mode == NuGenGradientMode.ForwardDiagonal) gradient = LinearGradientMode.ForwardDiagonal; LinearGradientBrush gb = new LinearGradientBrush(rect, color1, color2, gradient); e.FillRectangle(gb, rect); gb.Dispose(); }