A newer version of this page is available. Switch to the current version.

SchedulerControl.CustomDrawTimeRegion Event

Handle this event to manually re-paint Time Regions.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v19.1.dll


public event EventHandler<CustomDrawTimeRegionEventArgs> CustomDrawTimeRegion
Public Event CustomDrawTimeRegion As EventHandler(Of CustomDrawTimeRegionEventArgs)

Event Data

The CustomDrawTimeRegion event's data class is DevExpress.XtraScheduler.CustomDrawTimeRegionEventArgs.


In the DevExpress Scheduler demo this event is handled to draw a "lunch" icon on top of the 1p.m.~2p.m. region.

Time Regions

SvgImage svgImage = DemoUtils.GetResourceSvgImage("Images.Dinner.svg");
scheduler.CustomDrawTimeRegion += (s, e) => {
    if (e.TimeRegion == timeRegion2)
    Rectangle bounds = new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);
    double scaleFactor = bounds.Height / svgImage.Height;
    Image img = svgImage.Render(null, Math.Min(scaleFactor, 1));
    int x = e.Bounds.Location.X + (e.Bounds.Width / 2 - img.Width / 2);
    int y = e.Bounds.Location.Y + (e.Bounds.Height / 2 - img.Height / 2);
    e.Cache.DrawImage(img, new Point(x, y));
    e.Handled = true;
See Also