HeaderPane
Main
Hide
Share Link
Print

DayFormattingEventArgs Class

Provides data for the SftDate.DayFormatting event, which defines how a calendar shows a day.

The event is raised for each day before it is shown. The properties start with the values defined by the calendar settings and the special dates; an event handler changes them. A disabled day cannot be selected.

Namespace: Softelvdm.SftDateNET
Assembly: Softelvdm.SftDateNET

Inheritance

Syntax

public class DayFormattingEventArgs : System.EventArgs;
Public Class DayFormattingEventArgs
    Inherits System.EventArgs

Constructors

This class cannot be instantiated.

Properties

PublicBackColorDefines the background color of the day, or Color.Empty for the default.
PublicBoldDefines whether the day is shown in bold.
PublicDateReturns the date.
PublicEnabledDefines whether the day can be selected.
PublicFontDefines the font of the day, or null for the calendar's font.
PublicForeColorDefines the text color of the day, or Color.Empty for the default.
PublicImageDefines an image shown with the day, or null.
PublicInRangeReturns whether the date is within the range of dates that can be selected (SftDate.MinDate and SftDate.MaxDate).
PublicIsTodayReturns whether the date is today's date.
PublicIsWeekendReturns whether the date falls on a Saturday or Sunday.
PublicSpecialDateReturns the special date that applies to the date, or null.
PublicTextDefines the text shown for the day, or null for the day number.
PublicToolTipDefines the tooltip of the day, or an empty string for none.

Fields

PublicStaticInherited from System.EventArgsEmptyProvides a value to use with events that do not have event data.

Methods

PublicInherited from System.ObjectEqualsDetermines whether the specified object is equal to the current object.
ProtectedInherited from System.ObjectFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
PublicInherited from System.ObjectGetHashCodeServes as the default hash function.
PublicInherited from System.ObjectGetTypeGets the Type of the current instance.
ProtectedInherited from System.ObjectMemberwiseCloneCreates a shallow copy of the current Object.
PublicStaticInherited from System.ObjectReferenceEqualsDetermines whether the specified Object instances are the same instance.
PublicInherited from System.ObjectToStringReturns a string that represents the current object.

Examples

C# View entire sample code

                day = calendar.SpecialDates.Add(monday, RecurrenceEnum.Weekly);
                day.Bold = false;
                day.ForeColor = Color.RoyalBlue;
                day.ToolTip = "Team meeting";
            });
        }

        // The DayFormatting event can change any day; here weekends without a special date are colored.
        private void AnyControl_DayFormatting(object sender, DayFormattingEventArgs e) {
            if (checkWeekends.Checked && e.IsWeekend && e.SpecialDate == null)
                e.ForeColor = Color.IndianRed;
        }

        private void checkWeekends_CheckedChanged(object sender, EventArgs e) {
            sftCalendar1.RefreshDays();
        }

VB.NET View entire sample code

                day.Bold = False
                day.ForeColor = Color.RoyalBlue
                day.ToolTip = "Team meeting"
            End If
        Next
    End Sub

    ' The DayFormatting event can change any day; here weekends without a special date are colored.
    Private Sub AnyControl_DayFormatting(ByVal sender As Object, ByVal e As DayFormattingEventArgs) Handles SftDate1.DayFormatting, SftDate2.DayFormatting, SftDate5.DayFormatting, SftDate6.DayFormatting, SftDate7.DayFormatting, SftDate8.DayFormatting, SftDate9.DayFormatting, SftCalendar1.DayFormatting
        If CheckWeekends.Checked AndAlso e.IsWeekend AndAlso e.SpecialDate Is Nothing Then
            e.ForeColor = Color.IndianRed
        End If
    End Sub

    Private Sub CheckWeekends_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles CheckWeekends.CheckedChanged
        SftCalendar1.RefreshDays()

See Also Classes | SftDate/NET 3.0