Scheduler appointments can represent tasks to be completed. If you are informed about the progress of a task, you may wish to indicate it using different colors. For example, the part of the appointment rectangle corresponding to the completed job should be painted in green, while the remaining rectangle should be painted in orange.
To accomplish this, handle the CustomDrawAppointmentBackground event. Use the e.ObjectInfo property to get access to the ViewInfo object, containing information about the appointment being displayed.
Consider the Timeline view, in which each appointment has only one corresponding ViewInfo object. The viewInfo.Bounds property provides the coordinates of the appointment rectangle. The appointment rectangle is checked for the left and right border to determine what part of it is shown on the screen. It is necessary since we should take into account the entire appointment to determine what part of it should be colored differently. With the AppointmentInterval and Interval properties of the AppointmentViewInfo object, we can calculate the dimensions of hidden and visible parts. The variable "CompletenessRatio" represents the ratio of a completed task to the entire task. Now we can paint the visible rectangle using green and orange brushes according to the completed percentage of the job.
Note that you should set the SnapToCellsMode property to Never. Otherwise, there will be some inaccuracy in calculations, although for the Minute, Hour and Day scales this error is negligible.