Imports System.Diagnostics
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Initialize UltraDayView control level properties.
' Add a gradient backcolor to the AllDayEventArea
Me.UltraDayView1.AllDayEventAreaAppearance.BackColor = Color.CadetBlue
Me.UltraDayView1.AllDayEventAreaAppearance.BackColor2 = Color.Blue
Me.UltraDayView1.AllDayEventAreaAppearance.BackGradientStyle = GradientStyle.Horizontal
' Change the control's forecolor to dark blue.
Me.UltraDayView1.AllDayEventAreaAppearance.ForeColor = Color.Blue
' Set AutoAppointmentDialog to true. This will cause the Appointment dialog
' to be automaticall displayed when the user double-clicks on an appointment
' or time slot.
Me.UltraDayView1.AutoAppointmentDialog = True
' Change the border style to raised.
Me.UltraDayView1.BorderStyle = UIElementBorderStyle.Raised
' Check the control's current state - if there is an appointment currently in edit
' write a message to the output window.
If ((Me.UltraDayView1.CurrentState And UltraDayViewState.AppointmentInEdit) <> 0) Then
Debug.WriteLine("Appointment in edit")
End If
' Set come edit appearance colors.
Me.UltraDayView1.EditAppearance.BackColor = Color.Black
Me.UltraDayView1.EditAppearance.ForeColor = Color.Green
' If the first visible time slot's starting time is equal to 12, display a message
' in the output window.
If (Me.UltraDayView1.FirstVisibleTimeSlot.StartTime.Hour = 12) Then
Debug.WriteLine("The noontime time slot is positioned at the top of the day view.")
End If
' Hide the time slot descriptor area.
Me.UltraDayView1.HideTimeSlotDescriptorArea = True
' Set the time bar color for time slots with no activity to Gray.
Me.UltraDayView1.IdleTimeBarColor = Color.Gray
' Change the backcolor for the time slots.
Me.UltraDayView1.NonWorkingHourTimeSlotAppearance.BackColor = Color.CadetBlue
Me.UltraDayView1.WorkingHourTimeSlotAppearance.BackColor = Color.LightBlue
' Make sure the dayview's scrollbar is visible.
Me.UltraDayView1.ScrollbarVisible = True
' Change the backcolor for selected time slots if the currently selected time
' starts before noon.
If (Me.UltraDayView1.SelectedTimeSlotRange.StartDateTime.Hour < 12) Then
Me.UltraDayView1.SelectedTimeSlotAppearance.BackColor = Color.CadetBlue
End If
' Change the backcolor of the selected visible day.
Me.UltraDayView1.SelectedVisibleDayAppearance.BackColor = Color.Red
' Look at each selected visible day and display a message in the output window for
' each day that is in the first week of the year.
Dim selectedVisibleDay As VisibleDay
For Each selectedVisibleDay In Me.UltraDayView1.SelectedVisibleDays
If (selectedVisibleDay.Day.Week.WeekNumber = 1) Then
Debug.WriteLine("Selected visible day found in week 1. (Date: " + selectedVisibleDay.Date.ToString() + ")")
End If
Next
' Add a gradient the TimeSlotDescriptors.
Me.UltraDayView1.TimeSlotDescriptorAppearance.BackColor2 = SystemColors.ControlDark
Me.UltraDayView1.TimeSlotDescriptorAppearance.BackGradientStyle = GradientStyle.Horizontal
' Set the time slot interval to every 15 minutes.
Me.UltraDayView1.TimeSlotInterval = TimeSlotInterval.FifteenMinutes
' Set the backcolor to green for each time slot that starts on the half hour.
Dim timeSlot As TimeSlot
For Each timeSlot In Me.UltraDayView1.TimeSlots
If timeSlot.StartTime.Minute = 30 Then
timeSlot.NonWorkingHourAppearance.BackColor = Color.Green
timeSlot.WorkingHourAppearance.BackColor = Color.Green
End If
Next
' Display the DayView control's current dimensions in the output window.
Debug.WriteLine("The DayView's dimensions are: " + Me.UltraDayView1.UIElement.Rect.Width.ToString() + " x " + Me.UltraDayView1.UIElement.Rect.Height.ToString())
' Look at each visible day and display a message in the output window for
' each visible day that falls on monday.
Dim visibleDay As VisibleDay
For Each visibleDay In Me.UltraDayView1.SelectedVisibleDays
If visibleDay.Date.DayOfWeek = System.DayOfWeek.Monday Then
Debug.WriteLine("Visible day found that falls on a monday. (Date: " + visibleDay.Date.ToString() + ")")
End If
Next
End Sub