private void dateTimeInput11_MonthCalendar_PaintLabel(object sender, DevComponents.Editors.DateTimeAdv.DayPaintEventArgs e) { DevComponents.Editors.DateTimeAdv.DayLabel day = sender as DevComponents.Editors.DateTimeAdv.DayLabel; if (day == null || day.Date == DateTime.MinValue) { return; } // Cross all weekend days and disable selection for them... if ((day.Date.DayOfWeek == DayOfWeek.Saturday || day.Date.DayOfWeek == DayOfWeek.Sunday) && day.Date != DateTime.Today.AddDays(1)) { day.Selectable = false; // Mark label as not selectable... day.TrackMouse = false; // Do not track mouse movement... e.PaintBackground(); e.PaintText(); Rectangle r = day.Bounds; r.Inflate(-2, -2); SmoothingMode sm = e.Graphics.SmoothingMode; e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; e.Graphics.DrawLine(Pens.Red, r.X, r.Y, r.Right, r.Bottom); e.Graphics.DrawLine(Pens.Red, r.Right, r.Y, r.X, r.Bottom); e.Graphics.SmoothingMode = sm; // Ensure that no part is rendered internally by control... e.RenderParts = DevComponents.Editors.DateTimeAdv.eDayPaintParts.None; } // Mark tomorrows day... else if (day != null && day.Date == DateTime.Today.AddDays(1)) { e.PaintBackground(); e.PaintText(); SmoothingMode sm = e.Graphics.SmoothingMode; e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; Rectangle r = day.Bounds; r.Width--; r.Height--; using (Pen pen = new Pen(Color.FromArgb(128, Color.Blue))) e.Graphics.DrawEllipse(pen, r); e.Graphics.SmoothingMode = sm; // Ensure that no part is rendered internally by control... e.RenderParts = DevComponents.Editors.DateTimeAdv.eDayPaintParts.None; } }
/// <summary> /// Returns copy of the item. /// </summary> public override BaseItem Copy() { DayLabel objCopy = new DayLabel(); this.CopyToItem(objCopy); return objCopy; }
/// <summary> /// Initializes a new instance of the CalendarMonth class. /// </summary> public SingleMonthCalendar() { _FirstDayOfWeek = DateTimeInput.GetActiveCulture().DateTimeFormat.FirstDayOfWeek; m_IsContainer = true; this.AutoCollapseOnClick = true; this.MouseUpNotification = true; this.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; _Colors.Parent = this; for (int i = 0; i < 49; i++) { DayLabel day = new DayLabel(); day.Visible = false; this.SubItems.Add(day); } // Add navigation container Size fixedButtonSize = new Size(13, 18); ItemContainer cont = new ItemContainer(); cont.Name = NavigationContainerName; cont.AutoCollapseOnClick = false; cont.MinimumSize = new Size(0, fixedButtonSize.Height + 3); cont.LayoutOrientation = eOrientation.Horizontal; cont.HorizontalItemAlignment = eHorizontalItemsAlignment.Center; cont.VerticalItemAlignment = eVerticalItemsAlignment.Middle; cont.ItemSpacing = 2; ButtonItem nav = new ButtonItem(NavDecreaseMonth); nav.GlobalItem = false; nav._FadeEnabled = false; nav.Text = "<expand direction=\"left\"/>"; nav.Click += new EventHandler(MonthNavigationDecreaseClick); nav.AutoCollapseOnClick = false; nav.FixedSize = fixedButtonSize; nav._FixedSizeCenterText = true; nav.ClickAutoRepeat = true; cont.SubItems.Add(nav); LabelItem label = new LabelItem(NavMonthLabel); label.AutoCollapseOnClick = false; label.GlobalItem = false; label.TextAlignment = StringAlignment.Center; label.TextLineAlignment = StringAlignment.Center; label.PaddingBottom = 2; label.Click += new EventHandler(ShowMonthSelectionPopupMenu); cont.SubItems.Add(label); nav = new ButtonItem(NavIncreaseMonth); nav.GlobalItem = false; nav._FadeEnabled = false; nav.Text = "<expand direction=\"right\"/>"; nav.Click += new EventHandler(MonthNavigationIncreaseClick); nav.AutoCollapseOnClick = false; nav.FixedSize = fixedButtonSize; nav._FixedSizeCenterText = true; nav.ClickAutoRepeat = true; cont.SubItems.Add(nav); // Year Navigation nav = new ButtonItem(NavDecreaseYear); nav.GlobalItem = false; nav._FadeEnabled = false; nav.Text = "<expand direction=\"left\"/>"; nav.Click += new EventHandler(YearNavigationDecreaseClick); nav.AutoCollapseOnClick = false; nav.FixedSize = fixedButtonSize; nav._FixedSizeCenterText = true; nav.ClickAutoRepeat = true; cont.SubItems.Add(nav); label = new LabelItem(NavYearLabel); label.AutoCollapseOnClick = false; label.GlobalItem = false; label.TextAlignment = StringAlignment.Center; label.TextLineAlignment = StringAlignment.Center; label.PaddingBottom = 2; label.Click += ShowYearSelection; label.Cursor = Cursors.Hand; cont.SubItems.Add(label); nav = new ButtonItem(NavIncreaseYear); nav.GlobalItem = false; nav._FadeEnabled = false; nav.Text = "<expand direction=\"right\"/>"; nav.Click += new EventHandler(YearNavigationIncreaseClick); nav.AutoCollapseOnClick = false; nav.FixedSize = fixedButtonSize; nav._FixedSizeCenterText = true; nav.ClickAutoRepeat = true; cont.SubItems.Add(nav); _MonthsPopupMenu = new ButtonItem(MonthsPopupMenu); _MonthsPopupMenu.Visible = false; cont.SubItems.Add(_MonthsPopupMenu); this.SubItems.Add(cont); }
private void ResetDayLabel(DayLabel day) { day.IsSelected = false; day.Selectable = true; day.TrackMouse = true; day.IsToday = false; day.IsBold = false; day.Image = null; day.ImageAlign = eLabelPartAlignment.MiddleRight; day.TextAlign = _DefaultDayLabelTextAlign; day.TextColor = Color.Empty; day.Tooltip = ""; day.ExpandOnMouseDown = false; day.SubItems.Clear(); day.BackgroundStyle.Reset(); }
private void ApplyMarker(DayLabel day, DateAppearanceDescription c) { day.BackgroundStyle.BackColor = c.BackColor; day.BackgroundStyle.BackColor2 = c.BackColor2; day.BackgroundStyle.BackColorGradientAngle = c.BackColorGradientAngle; if (!c.BorderColor.IsEmpty) { day.BackgroundStyle.Border = eStyleBorderType.Solid; day.BackgroundStyle.BorderColor = c.BorderColor; day.BackgroundStyle.BorderWidth = 1; } day.IsBold = c.IsBold; if (!c.TextColor.IsEmpty) day.TextColor = c.TextColor; day.Selectable = c.Selectable; if (!c.Selectable) day.TrackMouse = false; }
private void ApplyMonthlyMarker(DayLabel day) { MonthCalendarColors c = GetColors(); if (c == null || !c.MonthlyMarker.IsCustomized) return; ApplyMarker(day, c.MonthlyMarker); }
internal void OnLabelMouseHover(DayLabel sender, EventArgs e) { if (LabelMouseHover != null) LabelMouseHover(sender, e); }
internal void OnLabelMouseMove(DayLabel sender, MouseEventArgs e) { if (LabelMouseMove != null) LabelMouseMove(sender, e); }
internal void OnLabelMouseDown(DayLabel sender, MouseEventArgs e) { if (LabelMouseDown != null) LabelMouseDown(sender, e); }
internal void DayLabelClick(DayLabel day) { if (!_MouseSelectionEnabled) return; if (day.Selectable && day.Date != DateTime.MinValue) { if (!_WeekendDaysSelectable && DayLabel.IsWeekend(day.Date)) return; if (MultiSelect) { if (_SelectedDate == DateTime.MinValue) _SelectedDate = day.Date; day.IsSelected = !day.IsSelected; } else { SelectedDate = day.Date; } } }
/// <summary> /// Raises the PaintLabel event. /// </summary> /// <param name="e">Provides event data.</param> internal void OnPaintLabel(DayLabel label, DayPaintEventArgs e) { if (PaintLabel != null) PaintLabel(label, e); }
private void OnShowWeekNumbersChanged() { if (_ShowWeekNumbers) { // Add week of year labels, always after the days for (int i = 0; i < 6; i++) { DayLabel week = new DayLabel(); week.IsWeekOfYear = true; this.SubItems.Insert(49 + i, week); } } else { // Remove week of year labels for (int i = 0; i < 7; i++) { DayLabel week = this.SubItems[49] as DayLabel; if (week != null && week.IsWeekOfYear) this.SubItems.Remove(49); } } }
/// <summary> /// Initializes a new instance of the DayPaintEventArgs class. /// </summary> /// <param name="graphics">Reference to Graphics canvas.</param> /// <param name="item">Reference to item being rendered.</param> public DayPaintEventArgs(ItemPaintArgs p, DayLabel item) { Graphics = p.Graphics; _ItemPaintArgs = p; _Item = item; }
/// <summary> /// Raises the PaintLabel event. /// </summary> /// <param name="e">Provides event data.</param> protected virtual void OnPaintLabel(DayLabel label, DayPaintEventArgs e) { if (PaintLabel != null) PaintLabel(label, e); }