This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
/
AgendaViewHelper.vb
45 lines (41 loc) · 2.17 KB
/
AgendaViewHelper.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports DevExpress.XtraScheduler
Namespace WindowsFormsApplication1
Public Enum LabelDrawingMode
Bubble
Background
End Enum
Public Module AgendaViewHelper
<System.Runtime.CompilerServices.Extension> _
Public Sub SetLabelDrawingMode(ByVal scheduler As SchedulerControl, ByVal mode As LabelDrawingMode)
If mode = LabelDrawingMode.Background Then
scheduler.AgendaView.AppointmentDisplayOptions.ShowLabel = False
AddHandler scheduler.CustomDrawAppointment, AddressOf scheduler_CustomDrawAppointment
AddHandler scheduler.AppointmentViewInfoCustomizing, AddressOf scheduler_AppointmentViewInfoCustomizing
Else
scheduler.AgendaView.AppointmentDisplayOptions.ShowLabel = True
RemoveHandler scheduler.CustomDrawAppointment, AddressOf scheduler_CustomDrawAppointment
RemoveHandler scheduler.AppointmentViewInfoCustomizing, AddressOf scheduler_AppointmentViewInfoCustomizing
End If
End Sub
Private Sub scheduler_CustomDrawAppointment(ByVal sender As Object, ByVal e As CustomDrawObjectEventArgs)
Dim agendaViewInfo As DevExpress.XtraScheduler.Drawing.AgendaAppointmentViewInfo = TryCast(e.ObjectInfo, DevExpress.XtraScheduler.Drawing.AgendaAppointmentViewInfo)
If agendaViewInfo IsNot Nothing AndAlso agendaViewInfo.Selected Then
e.DrawDefault()
e.Cache.DrawRectangle(Pens.Black, e.Bounds)
e.Handled = True
End If
End Sub
Private Sub scheduler_AppointmentViewInfoCustomizing(ByVal sender As Object, ByVal e As AppointmentViewInfoCustomizingEventArgs)
Dim agendaViewInfo As DevExpress.XtraScheduler.Drawing.AgendaAppointmentViewInfo = TryCast(e.ViewInfo, DevExpress.XtraScheduler.Drawing.AgendaAppointmentViewInfo)
If agendaViewInfo IsNot Nothing Then
agendaViewInfo.Appearance.BackColor = agendaViewInfo.LabelColor
End If
End Sub
End Module
End Namespace