/
Form1.vb
107 lines (81 loc) · 3.36 KB
/
Form1.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
Imports Microsoft.VisualBasic
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports DevExpress.Utils
Imports DevExpress.XtraScheduler
Imports DevExpress.XtraScheduler.Drawing
Namespace SchedulerCustomTooltip
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
SetupCustomField()
SetupSampleResource()
SetupSampleAppointment()
schedulerControl1.OptionsView.ToolTipVisibility = ToolTipVisibility.Always
End Sub
Private Sub toolTipController1_BeforeShow(ByVal sender As Object, ByVal e As DevExpress.Utils.ToolTipControllerShowEventArgs) Handles toolTipController1.BeforeShow
If TypeOf toolTipController1.ActiveObject Is AppointmentViewInfo Then
Dim apt As Appointment = (CType(toolTipController1.ActiveObject, AppointmentViewInfo)).Appointment
e.ToolTipType = ToolTipType.SuperTip
Dim stt As New SuperToolTip()
Dim ttiTitle As New ToolTipTitleItem()
Dim ttiBody As New ToolTipItem()
Dim ttiFooter As New ToolTipItem()
ttiTitle.Text = "Appointment"
ttiBody.Text = String.Format("Subject: {0} " & Constants.vbLf & "Description: {1}" & Constants.vbLf & "Price: {2}", apt.Subject, apt.Description, apt.CustomFields("cfPrice"))
ttiBody.Image = SystemIcons.Information.ToBitmap()
ttiFooter.AllowHtmlText = DefaultBoolean.True
ttiFooter.Text = "<b>www.devexpress.com</b>"
ttiFooter.Appearance.BackColor = Color.Red
ttiFooter.Appearance.ForeColor = Color.Blue
ttiFooter.LeftIndent = 30
stt.Items.Add(ttiTitle)
stt.Items.AddSeparator()
stt.Items.Add(ttiBody)
stt.Items.AddSeparator()
stt.Items.Add(ttiFooter)
e.SuperTip = stt
End If
If TypeOf toolTipController1.ActiveObject Is ResourceHeader Then
Dim res As Resource = (CType(toolTipController1.ActiveObject, ResourceHeader)).Resource
e.ToolTipType = ToolTipType.Standard
e.Rounded = True
e.Title = "Resource"
e.ToolTip = res.Caption
End If
If TypeOf toolTipController1.ActiveObject Is DayHeader OrElse TypeOf toolTipController1.ActiveObject Is TimeScaleHeader Then
Dim interval As TimeInterval = (CType(toolTipController1.ActiveObject, SchedulerHeader)).Interval
e.ToolTipType = ToolTipType.Standard
e.IconType = ToolTipIconType.Exclamation
e.ShowBeak = True
e.Title = "TimeInterval"
e.ToolTip = interval.ToString()
End If
End Sub
Private Sub SetupCustomField()
schedulerControl1.Storage.Appointments.CustomFieldMappings.Add(New AppointmentCustomFieldMapping("cfPrice", "Price"))
End Sub
Private Sub SetupSampleResource()
Dim schedulerStorage As SchedulerStorage = schedulerControl1.Storage
Dim res As Resource = schedulerStorage.CreateResource(0)
res.Caption = "Resource1"
schedulerStorage.Resources.Add(res)
schedulerControl1.GroupType = SchedulerGroupType.Resource
End Sub
Private Sub SetupSampleAppointment()
Dim schedulerStorage As SchedulerStorage = schedulerControl1.Storage
Dim apt As Appointment = schedulerStorage.CreateAppointment(AppointmentType.Normal)
Dim baseTime As DateTime = DateTime.Today
apt.Start = baseTime.AddHours(1)
apt.End = baseTime.AddHours(2)
apt.Subject = "Test"
apt.Location = "Office"
apt.Description = "Test procedure"
apt.CustomFields("cfPrice") = 10
schedulerStorage.Appointments.Add(apt)
schedulerControl1.Start = baseTime
End Sub
End Class
End Namespace