Skip to main content
A newer version of this page is available. .

SchedulerControl.CustomDrawTimeRegion Event

Handle this event to manually re-paint Time Regions.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v19.2.dll

Declaration

public event EventHandler<CustomDrawTimeRegionEventArgs> CustomDrawTimeRegion

Event Data

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

Remarks

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)
        return;
    e.DrawDefault();
    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;
};

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CustomDrawTimeRegion event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also