This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
/
Form1.vb
66 lines (58 loc) · 2.73 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
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports DevExpress.XtraScheduler
Imports DevExpress.XtraReports.UI
Namespace SchedulerReportCustomDraw
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
Populate()
schedulerControl1.GroupType = SchedulerGroupType.Resource
schedulerControl1.DayView.TopRowTime = schedulerControl1.DayView.WorkTime.Start
schedulerControl1.DayView.DayCount = 3
schedulerControl1.Start = New Date(2014, 10, 12)
End Sub
Private Sub btnShowReport_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnShowReport.Click
Dim rep As New XtraSchedulerReport1()
rep.SchedulerAdapter.SetSourceObject(schedulerStorage1)
rep.SchedulerAdapter.TimeInterval = schedulerControl1.ActiveView.GetVisibleIntervals().Interval
Dim rpt As New ReportPrintTool(rep)
rpt.ShowPreviewDialog()
End Sub
Private Sub dateNavigator1_CustomDrawDayNumberCell(ByVal sender As Object, ByVal e As DevExpress.XtraEditors.Calendar.CustomDrawDayNumberCellEventArgs) Handles dateNavigator1.CustomDrawDayNumberCell
If e.Date.DayOfYear Mod 12 = 0 Then
Dim p As Pen = e.Cache.GetPen(Color.Violet)
Dim r As Rectangle = e.Bounds
r.Inflate(-2,0)
r.Offset(3, 0)
e.Cache.DrawRectangle(p, r)
End If
End Sub
Private Sub Populate()
Dim apt As Appointment = schedulerStorage1.CreateAppointment(AppointmentType.Pattern)
apt.Start = New Date(2014, 10, 12, 10, 0, 0)
apt.End = apt.Start.AddHours(1.5R)
apt.RecurrenceInfo.Type = RecurrenceType.Monthly
apt.RecurrenceInfo.Start = apt.Start
apt.RecurrenceInfo.WeekOfMonth = WeekOfMonth.None
apt.RecurrenceInfo.DayNumber = 12
apt.RecurrenceInfo.Range = RecurrenceRange.OccurrenceCount
apt.RecurrenceInfo.OccurrenceCount = 13
apt.Subject = "Each 12th day of month"
apt.Location = "City Center"
apt.StatusKey = 2
apt.LabelKey = 3
apt.ResourceId = 1
schedulerStorage1.Appointments.Add(apt)
schedulerStorage1.Resources.Add(schedulerStorage1.CreateResource(1,"Resource One"))
schedulerStorage1.Resources.Add(schedulerStorage1.CreateResource(2, "Resource Two"))
schedulerStorage1.Resources.Add(schedulerStorage1.CreateResource(3, "Resource Three"))
End Sub
End Class
End Namespace