---
title: "C1Scheduler for Winforms：高亮选择项"
author: "C1SupportTeam"
date: "2013-03-29T15:32:59Z"
tags: []
categories: ["研发管理"]
slug: "c1scheduler-for-winforms"
draft: false
lastmod: "2013-03-29T15:32:59Z"
id: 1838759
url: "https://c1supportteam.iteye.com/blog/1838759"
---

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

更改“事件”的外观为最受欢迎功能之一。可以通过**BeforeAppointmentFormat** 事件定制。该事件中我们可以灵活定制“事件”的文本、图表、背景色。更多信息可以参考在线帮助文档：[Documentation](http://helpcentral.componentone.com/nethelp/c1schedule/#%21XMLDocuments/Ref/html/E_C1_Win_C1Schedule_C1Schedule_BeforeAppointmentFormat.htm) 。

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

参考代码：

```
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
```

 

![](http://our.componentone.com/wp-content/uploads/2012/08/New-AppointmentSelection.gif "New AppointmentSelection")

下载示例：

[Download C# Sample](http://our.componentone.com/wp-content/uploads/2012/08/Highlight_Selected_Appointment_C.zip)  
[Download VB.Net Sample](http://our.componentone.com/wp-content/uploads/2012/08/Highlight_Selected_Appointment_VB.Net_.zip)

 

葡萄城控件产品网站：[http://www.gcpowertools.com.cn/](http://www.gcpowertools.com.cn/index.htm)  
葡萄城技术支持论坛：[http://gcdn.grapecity.com/](http://gcdn.grapecity.com/)