Back to Devexpress

CalendarControlBase.CustomDrawDayNumberCell Event

windowsforms-devexpress-dot-xtraeditors-dot-controls-dot-calendarcontrolbase-46e1a048.md

latest5.6 KB
Original Source

CalendarControlBase.CustomDrawDayNumberCell Event

Occurs when drawing each day cell in the calendar.

Namespace : DevExpress.XtraEditors.Controls

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("CustomDraw")]
public event CustomDrawDayNumberCellEventHandler CustomDrawDayNumberCell
vb
<DXCategory("CustomDraw")>
Public Event CustomDrawDayNumberCell As CustomDrawDayNumberCellEventHandler

Event Data

The CustomDrawDayNumberCell event's data class is CustomDrawDayNumberCellEventArgs. The following properties provide information specific to this event:

PropertyDescription
BackgroundElementInfoGets or sets the skin element that is used to paint the background of the currently processed cell.
BoundsGets the painted element’s bounding rectangle.
ContentBoundsGets the bounds of the cell’s content (text).
DateGets the painted cell’s value. This property is obsolete. Use the DateTime property instead.
DateOnlyGets the painted cell’s DateOnly value.
DateTimeGets the painted cell’s DateTime value.
DisabledGets whether the painted cell is disabled.
HighlightedGets whether the currently processed cell is under the mouse cursor.
HolidayGets whether the painted cell corresponds to Saturday or Sunday.
InactiveGets whether the painted cell belongs to the previous or next month.
IsPressedGets whether the cell is currently pressed.
IsSpecialGets whether the cell corresponds to a “special” date.
SelectedGets a value indicating whether the processed day number cell is selected.
StateGets the current cell’s state.
StyleGets the painted date cell’s appearance settings.
TodayGets whether the painted cell corresponds to Today’s date.
ViewGets or sets the current View of data in the dropdown window.
ViewInfoContains information used for painting the current cell.

Remarks

The CustomDrawDayNumberCell event fires when a day cell in the calendar is about to be painted. Handle this event, for instance, if you wish to custom paint particular dates, e.g. by highlighting them.

If you custom paint day cells using the CustomDrawDayNumberCell event, set the Handled parameter to true to prevent the default painting mechanism from being invoked after your CustomDrawDayNumberCell event handler is completed. Otherwise, your painting will be overridden by the default painting mechanism.

Note

You can use drawing methods provided by the e.Graphics object to paint custom information in your CustomDrawDayNumberCell event handler.

Alternatively, you can use drawing methods provided by the e.Cache or e.Style objects. If using the methods provided by the e.Cache or e.Style objects, ensure that the static DevExpress.Utils.Paint.XPaint.ForceGDIPlusPaint method is called on the application startup. Otherwise, you may observe incorrect painting on some operating systems (e.g. Windows 7).

See Also

CalendarControlBase Class

CalendarControlBase Members

DevExpress.XtraEditors.Controls Namespace