HeaderPane
Main
Hide
Share Link
Print

Colors

All colors of the controls can be defined by the application: the colors of a field are properties of the SftDate control, the colors of a calendar are properties of the SftDateCalendar object returned by the Calendar property, for an SftCalendar control and for the dropdown calendar of an SftDate control (Calendar). A color left at -1 (colorSftDateDefault, the default) uses the matching Windows system color, or its dark mode counterpart while dark mode is active (see Dark Mode). While Windows High Contrast is active, the colors of the user's contrast theme are used instead (see High Contrast).

A color is an OLE_COLOR value. A Windows system color (an OLE_COLOR with the high-order bit set, such as ColorTranslator.ToOle(SystemColors.Highlight) in .NET) is used with its current RGB value; unlike the default -1, it does not follow dark mode.

Colors in .NET

In Windows Forms, the wrapper class exposes the colors of the SftDate control as System.Drawing.Color values; BackColor and ForeColor are named CtlBackColor and CtlForeColor, because Control.BackColor and Control.ForeColor exist already. The colors of the SftDateCalendar object, of special dates and of the DayFormatting event's object are uint values, converted with ColorTranslator.ToOle. The default -1 is not a System.Drawing.Color, so it is set through the control's interface (GetOcx), as the C# DemoSample does:

private const uint DefaultColor = unchecked((uint)SftDateColorConstants.colorSftDateDefault);

private static uint Ole(Color color) {
    return (uint)ColorTranslator.ToOle(color);
}

private void SetColors() {
    SftDateCalendar cal = sftCalendar1.Calendar;
    cal.TitleBackColor = Ole(Color.FromArgb(0, 95, 115));
    cal.TitleForeColor = Ole(Color.White);
    cal.SelectedBackColor = DefaultColor;

    sftDate1.CtlBackColor = Color.LightYellow;
    ISftDate ocx = (ISftDate)sftDate1.GetOcx();
    ocx.SegmentHighlightBackColor = DefaultColor;
}

Field Colors

These properties of the SftDate control define the colors of the field:

PropertyDescription
BackColor, ForeColorThe background and text colors of the field.
SegmentHighlightBackColor, SegmentHighlightForeColorThe colors of the part of the value being edited.
PlaceholderForeColorThe color of the placeholder text of an empty field, of empty parts and of the value while the check box is cleared.
BorderColorThe color of a borderSftDateFixedSingle border (BorderStyle).

A disabled field is shown in the system colors of disabled controls, and a disabled calendar in its DisabledForeColor color.

Calendar Colors

These properties of the SftDateCalendar object define the colors of an SftCalendar control and of the dropdown calendar of an SftDate control:

PropertyDescription
BackColor, ForeColorThe background color and the color of the days.
TitleBackColor, TitleForeColorThe background color of the titles, and the color of the titles and the previous and next buttons.
DayOfWeekForeColor, BorderColorThe color of the names of the days of the week and of the line below them.
TrailingForeColorThe color of the days of the previous and next month.
WeekendForeColorThe color of Saturdays and Sundays; by default, they have the color of the other days.
SelectedBackColor, SelectedForeColorThe colors of selected days.
RangeBackColorThe background color of the days between the first and the last day of a range.
HotBackColorThe background color of the day under the mouse.
TodayColorThe color of the outline of today's date.
DisabledForeColorThe color of days that cannot be selected.
WeekNumberForeColor, WeekNumberBackColorThe colors of the week numbers.

Special dates and the DayFormatting event define colors for individual days (see Special Dates and Day Formatting).

Colors and Dark Mode

Colors set by the application are used as given in dark mode too; only the default colors follow the mode. An application that supports dark mode and sets its own colors defines a variant for each mode, and sets the colors again when the mode changes, as the DemoSample does in the DarkModeChange event (DarkModeChange, DarkModeChange):

private void SetColorScheme(SftDateCalendar cal, bool dark) {
    cal.RangeBackColor = dark ? Ole(Color.FromArgb(95, 60, 20)) : Ole(Color.FromArgb(250, 225, 190));
    cal.DayOfWeekForeColor = dark ? Ole(Color.FromArgb(110, 190, 205)) : Ole(Color.FromArgb(0, 95, 115));
}

private void sftCalendar1_DarkModeChange(object sender, AxSftDateLib20._ISftCalendarEvents_DarkModeChangeEvent e) {
    SetColorScheme(sftCalendar1.Calendar, e.active);
}

The application calls SetColorScheme once when the form is loaded as well, with the control's DarkModeActive property. While high contrast is active, the colors set by the application are ignored.

Windows Themes

With UseThemes set to True (the default) and the default colors, the controls are drawn with the Windows themes of date fields and calendars. Setting a calendar's BackColor, SelectedBackColor, HotBackColor or TodayColor color draws the calendar without the theme (see Using Themes).


Last Updated 11/29/2026 - (email)
© 2026 Softel vdm, Inc.