Como mudar a cor do compromisso no DevExpress

Método 1: compromisso de sorteio personalizado

O único ponto chave é como desempacotar e.ObjectInfo para o tipo certo

private void SchedulerControl_CustomDrawAppointment(object sender, CustomDrawObjectEventArgs e)
{
HorizontalAppointmentViewInfo havi = e.ObjectInfo as HorizontalAppointmentViewInfo;
if (havi != null)
{
StringFormat sf = havi.Appearance.TextOptions.GetStringFormat();
sf
.Alignment = StringAlignment.Center;
Color fc = (havi.Appointment.LabelId == 0) ? Color.Red : Color.Black;
e
.Cache.DrawString(havi.Appointment.Description, havi.Appearance.Font, new SolidBrush(fc), e.Bounds, sf);
}
}

Método 2: Personalização ViewInfo de Compromisso

private void SchedulerControl_AppointmentViewInfoCustomizing(object sender, AppointmentViewInfoCustomizingEventArgs e)
{
if (e.ViewInfo.Appointment.LabelId > 0)
{
e
.ViewInfo.Appearance.Font = new Font(e.ViewInfo.Appearance.Font, FontStyle.Bold);
}
else
{
e
.ViewInfo.Appearance.ForeColor = Color.Red;
}
}