C1Scheduler for Winforms 自发布之日起就受到广大用户的欢迎。它拥有众多用户友好性功能,其中之一就是实现了 Microsoft Office Styling Scheduling 主题样式。

更改“事件”的外观为最受欢迎功能之一。可以通过BeforeAppointmentFormat 事件定制。该事件中我们可以灵活定制“事件”的文本、图表、背景色。更多信息可以参考在线帮助文档:Documentation

在本博客中,使用该特性,我们将阐述如何实现高亮选择项。

参考代码:

 

Private Sub C1Schedule1_BeforeAppointmentFormat(ByVal sender As Object, ByVal e As C1.Win.C1Schedule.BeforeAppointmentFormatEventArgs) Handles C1Schedule1.BeforeAppointmentFormat
   If C1Schedule1.SelectedAppointments.Contains(e.Appointment) Then
       e.BackColor = Color.Blue
   Else
       e.BackColor = e.Appointment.Label.Color
   End If
End Sub
 
Private Sub C1Schedule1_SelectedAppointmentsChanged(ByVal sender As Object, ByVal e As C1.Win.C1Schedule.SelectedAppointmentsChangedEventArgs) Handles C1Schedule1.SelectedAppointmentsChanged
   For Each app As Appointment In C1Schedule1.DataStorage.AppointmentStorage.Appointments
       If C1Schedule1.SelectedAppointments.Contains(app) Then
          app.Tag = "change"
       Else
          app.Tag = Nothing
       End If
   Next
End Sub

下载示例:

Download C# Sample
Download VB.Net Sample