CustomDrawObjectEventArgs.ObjectInfo Property

Gets information on the painted element.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v20.1.dll

Declaration

public ObjectInfoArgs ObjectInfo { get; }
Public ReadOnly Property ObjectInfo As ObjectInfoArgs

Property Value

Type Description
DevExpress.Utils.Drawing.ObjectInfoArgs

A DevExpress.Utils.Drawing.ObjectInfoArgs class which provides information on the painted element.

Remarks

Use the ObjectInfo property to obtain the painted element's settings and perform custom painting based upon these settings.

Examples

The following sample code handles the SchedulerControl.CustomDrawAppointment event to manually paint appointments. The image below shows the result.

CustomDrawAppointment

using DevExpress.XtraScheduler;
using DevExpress.XtraScheduler.Drawing;
using System.Drawing.Drawing2D;
private void schedulerControl1_CustomDrawAppointment(object sender, CustomDrawObjectEventArgs e) {
    TimeLineAppointmentViewInfo tlvi = e.ObjectInfo as TimeLineAppointmentViewInfo;
    // This code works only for the Timeline View.
    if(tlvi != null) {
        Rectangle r = e.Bounds;
        r.Offset(3, 3);
        string[] s = tlvi.Appointment.Subject.Split(' ');

        for(int i = 0; i < s.Length; i++) {
            using(var foreBrush = new SolidBrush(colorArray[i]))
                e.Cache.DrawString(s[i], tlvi.Appearance.Font, foreBrush,
r, StringFormat.GenericDefault);
            SizeF shift = e.Cache.CalcTextSize(s[i] + " ", tlvi.Appearance.Font);
            r.X += (int)shift.Width;
        }
        e.Handled = true;
    }
}
See Also