'Declaration Public Event BeforeTimeFormat As System.EventHandler(Of BeforeTimeFormatEventArgs)
public event System.EventHandler<BeforeTimeFormatEventArgs> BeforeTimeFormat
Event Data
The event handler receives an argument of type BeforeTimeFormatEventArgs containing data related to this event. The following BeforeTimeFormatEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Background | Gets or sets System.Drawing.Color value specifying custom background color for the time interval element. |
Duration | Gets the System.TimeSpan value determining the duration of the time interval to format. |
Group | Gets the ScheduleGroupItem object which is currently formatted. |
Start | Gets the System.DateTime value determining the start date and time of the time interval to format. |
WorkTime | Gets or sets a value indicating whether time interval should be displayed as a working time. |
Remarks
Use this event to alter default time interval appearance. For example, to display different working hours for different days.
Example
This sample shows how to alter time interval appearance depending on BeforeTimeFormatEventArgs properties.
private void c1Schedule1_BeforeTimeFormat(object sender, BeforeTimeFormatEventArgs e) { if (e.Start.TimeOfDay == TimeSpan.FromMinutes(120)) { e.WorkTime = true; if (e.Start.DayOfWeek == DayOfWeek.Sunday) { e.Background = Color.Red; } } else if (e.Start.TimeOfDay == TimeSpan.FromMinutes(240) && e.Start.DayOfWeek != DayOfWeek.Sunday) { e.Background = c1Schedule1.Theme.Palette.FreeHourBorder; } else { if (e.Start.DayOfWeek == DayOfWeek.Sunday && e.Duration.TotalDays == 1) { e.Background = Color.Navy; } } }
See Also