TMlSkinCalendar

A calendar control that shows a month in place and lets you owner-draw the cells, for example to mark days that have appointments.

Category
Edits & pickers
Unit
uMlSkinCalendar.pas
Inherits from
TMlSkinCustomPanelTMlSkinCustomControl

Notes

  • Year and Month set the month on display; FocusDay is the selected day.
  • The header row and the day cells are styled separately: HeaderColor, HeaderFont, CellColor and CellFont.
  • Clicking a day fires OnCellClick; to draw markers inside a cell (a dot on days with events, say) use OnCellDrawing.
  • The weekday labels are customizable through TextSuTextSa, which makes localization easy.

Properties 24

NameTypeDefaultDescription
HolidayTextColorTColorText color used for weekend days.
HeaderColorTColorBackground color of the header row.
HeaderFontTFontFont of the header row.
HeaderHeightIntegerHeight of the header row in pixels.
CellColorTColorBackground color of the day cells.
CellFocusColorTColorBackground color of the selected day cell.
CellFontTFontFont of the day numbers.
TextSustringHeader label for Sunday.
TextMostringHeader label for Monday.
TextTustringHeader label for Tuesday.
TextWestringHeader label for Wednesday.
TextThstringHeader label for Thursday.
TextFrstringHeader label for Friday.
TextSastringHeader label for Saturday.
YearWordThe year on display.
MonthWordThe month on display (1–12).
FocusDayWordThe selected day of the month.
PaddingIntegerPadding in pixels between the calendar content and the control edge.
FrameColorTColorBorder color.
MaxDateTDateLatest selectable date.
MinDateTDateEarliest selectable date.
AlphaByte192Opacity: 0 fully transparent, 255 opaque.
BorderSidesTSidesWhich border edges are drawn — any combination of top, bottom, left and right.
BorderColorTColor$00D9CBBABorder color.

Events 3

NameTypeDefaultDescription
OnCellClickTCellClickEventFires when a day cell is clicked; the handler receives the day that was clicked.
OnCellDrawingTDrawCellEventFires while a day cell is drawn, so you can paint your own markers inside it — a dot on days with appointments, for instance.
OnChangedTNotifyEventFires after the state or value has changed.
Properties of TMlSkinCustomPanel 1
NameTypeDefaultDescription
ColorTColorclWhiteBackground color of the control; ignored while Transparent is on.
Events of TMlSkinCustomPanel 1
NameTypeDefaultDescription
OnCustomDrawTMlCustomDrawEventCustom draw event: paint your own content after the control has drawn itself.
Properties of TMlSkinCustomControl 5
NameTypeDefaultDescription
AboutTMlAboutInfoA design-time property: double-clicking it in the Object Inspector opens the MLSkin about box with the component version. It has no effect at run time and is not stored in the .dfm.
TransparentBooleanTrueTransparent background: the control skips its own fill and shows the form background (image or color) instead.
ColorTColorclWhiteBackground color of the control; ignored while Transparent is on.
AutoInvalidateBooleanFalseRepaints automatically when the content changes. Turn it on if property changes do not show up.
EraseBackgroundBooleanFalseWhether the background is erased before painting; worth toggling if the control flickers.
Events of TMlSkinCustomControl 4
NameTypeDefaultDescription
OnDPIChangedTMlDPIChangedEventFires when the screen DPI changes, for example when the window moves to a monitor with a different scaling — a good place to re-adjust anything you draw yourself.
OnBackgroundChangingTMlBackgroundEventFires just before the background changes, giving you a chance to adjust what is drawn.
OnBackgroundChangedTMlCustomDrawEventFires after the background has been drawn, so you can paint on top of it.
OnVisibleChangedTNotifyEventFires when the control is shown or hidden.

Only the properties and events MLSkin adds are listed here. Standard VCL properties such as Align, Anchors, Font and OnClick are available too and behave exactly as on the stock controls.

Offline helpA PDF / CHM version is available for offline reading.