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
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; private void Form1_Load(object sender, System.EventArgs e) { // Initialize UltraDayView control level properties. // Add a gradient backcolor to the AllDayEventArea this.ultraDayView1.AllDayEventAreaAppearance.BackColor = Color.CadetBlue; this.ultraDayView1.AllDayEventAreaAppearance.BackColor2 = Color.Blue; this.ultraDayView1.AllDayEventAreaAppearance.BackGradientStyle = GradientStyle.Horizontal; // Change the control's forecolor to dark blue. this.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. this.ultraDayView1.AutoAppointmentDialog = true; // Change the border style to raised. this.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 ( (this.ultraDayView1.CurrentState & UltraDayViewState.AppointmentInEdit) == UltraDayViewState.AppointmentInEdit) Debug.WriteLine("Appointment in edit"); // Set come edit appearance colors. this.ultraDayView1.EditAppearance.BackColor = Color.Black; this.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 (this.ultraDayView1.FirstVisibleTimeSlot.StartTime.Hour == 12) Debug.WriteLine("The noontime time slot is positioned at the top of the day view."); // Hide the time slot descriptor area. this.ultraDayView1.HideTimeSlotDescriptorArea = true; // Set the time bar color for time slots with no activity to Gray. this.ultraDayView1.IdleTimeBarColor = Color.Gray; // Change the backcolor for the time slots. this.ultraDayView1.NonWorkingHourTimeSlotAppearance.BackColor = Color.CadetBlue; this.ultraDayView1.WorkingHourTimeSlotAppearance.BackColor = Color.LightBlue; // Make sure the dayview's scrollbar is visible. this.ultraDayView1.ScrollbarVisible = true; // Change the backcolor for selected time slots if the currently selected time // starts before noon. if (this.ultraDayView1.SelectedTimeSlotRange.StartDateTime.Hour < 12) this.ultraDayView1.SelectedTimeSlotAppearance.BackColor = Color.CadetBlue; // Change the backcolor of the selected visible day. this.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. foreach(VisibleDay selectedVisibleDay in this.ultraDayView1.SelectedVisibleDays) { if (selectedVisibleDay.Day.Week.WeekNumber == 1) Debug.WriteLine("Selected visible day found in week 1. (Date: " + selectedVisibleDay.Date.ToString() + ")"); } // Add a gradient the TimeSlotDescriptors. this.ultraDayView1.TimeSlotDescriptorAppearance.BackColor2 = SystemColors.ControlDark; this.ultraDayView1.TimeSlotDescriptorAppearance.BackGradientStyle = GradientStyle.Horizontal; // Set the time slot interval to every 15 minutes. this.ultraDayView1.TimeSlotInterval = TimeSlotInterval.FifteenMinutes; // Set the backcolor to green for each time slot that starts on the half hour. foreach(TimeSlot timeSlot in this.ultraDayView1.TimeSlots) { if (timeSlot.StartTime.Minute == 30) { timeSlot.NonWorkingHourAppearance.BackColor = Color.Green; timeSlot.WorkingHourAppearance.BackColor = Color.Green; } } // Display the DayView control's current dimensions in the output window. Debug.WriteLine("The DayView's dimensions are: " + this.ultraDayView1.UIElement.Rect.Width.ToString() + " x " + this.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. foreach(VisibleDay visibleDay in this.ultraDayView1.SelectedVisibleDays) { if (visibleDay.Date.DayOfWeek == System.DayOfWeek.Monday) Debug.WriteLine("Visible day found that falls on a monday. (Date: " + visibleDay.Date.ToString() + ")"); } }