Skip to main content

SchedulerControl.CustomDrawAppointmentFlyoutSubject Event

Occurs before displaying the appointment flyout. Follows the SchedulerControl.CustomizeAppointmentFlyout event. Enables you to manually draw the visual elements composing the Subject rectangle without having to do a full default draw.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v22.1.dll

NuGet Package: DevExpress.Win.Scheduler


public event CustomDrawAppointmentFlyoutSubjectEventHandler CustomDrawAppointmentFlyoutSubject

Event Data

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

Property Description
Appointment Provides access to an appointment for which the flyout is invoked.
Bounds Returns the bounding rectangle of the drawing area. Inherited from CustomDrawObjectEventArgs.
Cache Gets an object which specifies the storage for the pens, fonts and brushes. Use it for custom painting in Scheduler Reports. Inherited from CustomDrawObjectEventArgs.
Graphics Gets an object used for painting. Inherited from CustomDrawObjectEventArgs.
Handled Gets or sets whether an event was handled. If it was handled, the default actions are not required. Inherited from CustomDrawObjectEventArgs.
ObjectInfo Gets information on the painted element. Inherited from CustomDrawObjectEventArgs.
StatusBounds Gets the location and size of the status line in the flyout’s Subject rectangle.

The event data class exposes the following methods:

Method Description
DrawBackgroundDefault() Renders the Subject rectangle background using the default drawing mechanism.
DrawDefault() Renders the element using the default drawing mechanism. Inherited from CustomDrawObjectEventArgs.
DrawStatusDefault() Renders the status line using the default drawing mechanism.


If the SchedulerOptionsCustomization.AllowDisplayAppointmentFlyout property is false, the CustomDrawAppointmentFlyoutSubject event as well as the SchedulerControl.CustomizeAppointmentFlyout event do not occur.

If the SchedulerControl.CustomizeAppointmentFlyout event is handled and the CustomizeAppointmentFlyoutEventArgs.ShowSubject property is set to false, the CustomDrawAppointmentFlyoutSubject event does not occur.


The following code handles the SchedulerControl.CustomDrawAppointmentFlyoutSubject event to draw a status line above the subject text and display a warning message if the status is AppointmentStatusType.Free.


View Example

void OnSchedulerControlCustomDrawAppointmentFlyoutSubject(object sender, CustomDrawAppointmentFlyoutSubjectEventArgs e) {
    e.Handled = true;
void CustomDrawAppointmentFlyoutSubject(CustomDrawAppointmentFlyoutSubjectEventArgs e) {
    AppointmentBandDrawerViewInfoBase viewInfo = (AppointmentBandDrawerViewInfoBase)e.ObjectInfo;
    CustomDrawAppointmentFlyoutSubject(e.Appointment, viewInfo);
void CustomDrawAppointmentFlyoutSubject(Appointment appointment, AppointmentBandDrawerViewInfoBase viewInfo) {
    GraphicsCache cache = viewInfo.Cache;
    StringFormat stringFormat = new StringFormat(viewInfo.View.Appearance.GetStringFormat());
    stringFormat.Alignment = stringFormat.LineAlignment = StringAlignment.Center;
    try {
        // Draw status
        Rectangle statusRect = GetStatusBounds(viewInfo);
        cache.FillRectangle(viewInfo.View.Status.GetBrush(), statusRect);

        if (viewInfo.View.Status.Type == AppointmentStatusType.Free) {
            // Draw a warning
            cache.DrawImage(GetWarningIcon(new Size(statusRect.Height, statusRect.Height)), statusRect.Location);
            cache.DrawString("Status is unacceptable", fontStorage.StatusFont, Brushes.Red, statusRect, stringFormat);
        // Draw subject                        
        cache.DrawString(appointment.Subject, fontStorage.SubjectFont, Brushes.Black, GetSubjectBounds(viewInfo), stringFormat);
    finally {
Rectangle GetSubjectBounds(AppointmentBandDrawerViewInfoBase viewInfo) {
    Rectangle bounds = viewInfo.Bounds;
    if (viewInfo.View.Status.Type == AppointmentStatusType.Free) {
        bounds.Offset(0, 10);
    return bounds;
Rectangle GetStatusBounds(AppointmentBandDrawerViewInfoBase viewInfo) {
    Rectangle bounds = Rectangle.Inflate(viewInfo.Bounds, -1, -1);
    if (viewInfo.View.Status.Type == AppointmentStatusType.Free) {
        bounds.Height = 20;
    else {
        bounds.Height = 5;
    return bounds;
Image GetWarningIcon(Size size) {
    using (Stream stream = AppAssembly.GetManifestResourceStream("CustomAppointmentFlyoutExample.warning.svg")) {
        var paletteProvider = SvgPaletteHelper.GetSvgPalette(schedulerControl1.LookAndFeel, ObjectState.Selected);
        return SvgBitmap.FromStream(stream).Render(size, paletteProvider);
static readonly Assembly AppAssembly = Assembly.GetExecutingAssembly();
See Also