This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form1.vb
85 lines (66 loc) · 3.08 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
Imports Microsoft.VisualBasic
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.XtraScheduler.Printing
Imports DevExpress.XtraPrinting
Namespace PrintAppointmentsInInterval
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
dateEdit1.DateTime = DateTime.Now.Date
timeEdit1.Time = dateEdit1.DateTime + schedulerControl1.DayView.WorkTime.Start
dateEdit2.DateTime = DateTime.Now.Date
timeEdit2.Time = dateEdit2.DateTime + schedulerControl1.DayView.WorkTime.End
End Sub
Private Sub GenerateAppointments()
For i As Integer = 0 To 1
Dim apt As Appointment = schedulerStorage1.CreateAppointment(DevExpress.XtraScheduler.AppointmentType.Normal)
apt.Start = DateTime.Now.AddHours(i+1)
apt.End = apt.Start.AddHours(2)
apt.Subject = "Test Appointment " & i
apt.ResourceId = schedulerStorage1.Resources(i).Id
schedulerStorage1.Appointments.Add(apt)
Next i
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
' TODO: This line of code loads data into the 'carsDBDataSet.Cars' table. You can move, or remove it, as needed.
Me.carsTableAdapter.Fill(Me.carsDBDataSet.Cars)
' TODO: This line of code loads data into the 'carsDBDataSet.CarScheduling' table. You can move, or remove it, as needed.
Me.carSchedulingTableAdapter.Fill(Me.carsDBDataSet.CarScheduling)
GenerateAppointments()
End Sub
Private Sub OnApptChangedInsertedDeleted(ByVal sender As Object, ByVal e As PersistentObjectsEventArgs) Handles schedulerStorage1.AppointmentsChanged, schedulerStorage1.AppointmentsInserted, schedulerStorage1.AppointmentsDeleted
carSchedulingTableAdapter.Update(carsDBDataSet)
carsDBDataSet.AcceptChanges()
End Sub
Private Sub btnPrint_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnPrint.Click
Dim pcl As New PrintableComponentLink(New PrintingSystem())
pcl.Component = Me.schedulerControl1
' Set page margins.
pcl.Margins = New System.Drawing.Printing.Margins(30, 30, 30, 30)
Dim pStyle As DailyPrintStyle = TryCast(Me.schedulerControl1.ActivePrintStyle, DailyPrintStyle)
' Set fonts for appointments and column headings.
pStyle.AppointmentFont = New Font("Arial", 8, FontStyle.Regular)
pStyle.HeadingsFont = New Font("Arial", 10, FontStyle.Regular)
' Specify whether the Calendar header should be printed.
pStyle.CalendarHeaderVisible = False
' Specify the intervals to print.
pStyle.PrintTime = New TimeOfDayInterval(timeEdit1.Time.TimeOfDay, timeEdit2.Time.TimeOfDay)
pStyle.StartRangeDate = dateEdit1.DateTime.Date
pStyle.EndRangeDate = dateEdit2.DateTime.Date
' Specify resources to print.
pStyle.ResourceOptions.CustomResourcesCollection.Add(schedulerStorage1.Resources(0))
pStyle.ResourceOptions.PrintCustomCollection = True
pStyle.PrintAllAppointments = False
pcl.CreateDocument()
pcl.ShowPreviewDialog()
End Sub
End Class
End Namespace