Back to Devexpress

SchedulerControl.CustomDrawView Event

windowsforms-devexpress-dot-xtrascheduler-dot-schedulercontrol-3ea45cf9.md

latest4.9 KB
Original Source

SchedulerControl.CustomDrawView Event

Enables drawing objects on the top of the scheduler view.

Namespace : DevExpress.XtraScheduler

Assembly : DevExpress.XtraScheduler.v25.2.dll

NuGet Package : DevExpress.Win.Scheduler

Declaration

csharp
public event CustomDrawObjectEventHandler CustomDrawView
vb
Public Event CustomDrawView As CustomDrawObjectEventHandler

Event Data

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

PropertyDescription
BoundsReturns the bounding rectangle of the drawing area.
CacheGets an object which specifies the storage for the pens, fonts and brushes. Use it for custom painting in Scheduler Reports.
GraphicsGets an object used for painting.
HandledGets or sets whether an event was handled. If it was handled, the default actions are not required.
ObjectInfoGets information on the painted element.

The event data class exposes the following methods:

MethodDescription
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.

csharp
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));
};
vb
schedulerControl1.DayView.AllowScrollAnimation = False
schedulerControl1.WorkWeekView.AllowScrollAnimation = False
schedulerControl1.FullWeekView.AllowScrollAnimation = False
schedulerControl1.MonthView.AllowScrollAnimation = False
AddHandler schedulerControl1.CustomDrawView,
    Sub(s, e) e.Cache.FillRectangle(e.Cache.GetSolidBrush(Color.Red), New Rectangle(0, 100, e.Bounds.Width, 100))

See Also

SchedulerControl Class

SchedulerControl Members

DevExpress.XtraScheduler Namespace