This example demonstrates the following techniques to customize the appearance of appointments:
-
Random r = new Random(); private void schedulerControl1_InitAppointmentDisplayText(object sender, AppointmentDisplayTextEventArgs e) { string[] stringArray = e.Text.Split(' '); StringBuilder builder = new StringBuilder(); foreach(string str in stringArray) builder.Append(string.Concat("<color=", r.Next(0, 255), ",", r.Next(0, 255), ",", r.Next(0, 255), ">", str, " ", "</color>")); e.Text = builder.ToString(); }
-
Custom Draw Appointments The CustomDrawAppointmentBackground event is handled to draw the border and invert the background color for selected appointments. In the Timeline View the subject is painted with different colors.
private void schedulerControl1_CustomDrawAppointmentBackground(object sender, CustomDrawObjectEventArgs e) { AppointmentViewInfo aptViewInfo = e.ObjectInfo as AppointmentViewInfo; if(aptViewInfo == null) return; if(aptViewInfo.Selected) { Rectangle r = e.Bounds; Brush brRect = aptViewInfo.Status.GetBrush(); e.Cache.FillRectangle(brRect, r); e.Cache.DrawRectangle(Pens.Blue, r); e.Handled = true; } }
The following screenshot shows the result:
(you will be redirected to DevExpress.com to submit your response)