Skip to main content

SchedulerControl.CustomDrawView Event

Enables drawing objects on the top of the scheduler view.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v23.2.dll

NuGet Package: DevExpress.Win.Scheduler

Declaration

public event CustomDrawObjectEventHandler CustomDrawView

Event Data

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

Property Description
Bounds Returns the bounding rectangle of the drawing area.
Cache Gets an object which specifies the storage for the pens, fonts and brushes. Use it for custom painting in Scheduler Reports.
Graphics Gets an object used for painting.
Handled Gets or sets whether an event was handled. If it was handled, the default actions are not required.
ObjectInfo Gets information on the painted element.

The event data class exposes the following methods:

Method Description
DrawDefault() Renders the element using the default drawing mechanism.
DrawHtml(HtmlTemplate, DxHtmlPainterContext, Action<DxHtmlPainterArgs>) Paints the required HTML template inside an element that raised this event. The context parameter allows you to assign an object that transfers mouse events to template elements.
DrawHtml(HtmlTemplate, Action<DxHtmlPainterArgs>) Paints the required HTML template inside an element that raised this event.
GetDisplayValue(String)
GetValue(String)

Remarks

Handle the CustomDrawView event to draw graphic objects on the surface of the Scheduler view. Use e.Cache and e.Graphics as drawing tools. Other properties of the CustomDrawObjectEventArgs instance can be ignored.

Note

The Date Navigation Bar is painted after the scheduler view and can overlap your drawings. Set the SchedulerDateNavigationBar.Visible property to false to hide this visual element.

To avoid possible issues, turn animation effects off when you custom draw a View.

schedulerControl1.DayView.AllowScrollAnimation = false;
schedulerControl1.WorkWeekView.AllowScrollAnimation = false;
schedulerControl1.FullWeekView.AllowScrollAnimation = false;
schedulerControl1.MonthView.AllowScrollAnimation = false;
schedulerControl1.CustomDrawView += (s, e) => {
    e.Cache.FillRectangle(e.Cache.GetSolidBrush(Color.Red), new Rectangle(0, 100, e.Bounds.Width, 100));
};
See Also