Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.Diagnostics
Private Sub ultraCalendarInfo1_AfterActiveDayChanged(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.AfterActiveDayChangedEventArgs) Handles ultraCalendarInfo1.AfterActiveDayChanged
'----------------------------------------------------------------------------------------------------
' 説明
' AfterActiveDayChanged
'
' コンポーネントの 'ActiveDay' が変更された後に発生します
' ActiveDay は、フォーカスを持つ日であると考えることができます
' 一度に 1 つのみのアクティブ日があるわけです
'
'----------------------------------------------------------------------------------------------------
Dim info As String = String.Empty
' 新しい ActiveDay の日付を取得します
info += "The date of the new ActiveDay is " + e.Day.Date.ToLongDateString() + vbCrLf
' 新しい ActiveDay の曜日を取得します
info += "The new ActiveDay falls on a " + e.Day.DayOfWeek.DayOfTheWeek.ToString() + vbCrLf
' ActiveDay の週番号を取得します
info += "The new ActiveDay falls in week number " + e.Day.Week.WeekNumber.ToString() + " of the year.\n"
' 月に日付の数を取得し、月の名前を取得します
Dim monthName As String = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthNames(e.Day.Month.MonthNumber - 1)
info += "The new ActiveDay is day number " + e.Day.DayNumber.ToString()
info += " in the month of " + monthName + vbCrLf
' 月に ActiveDay の位置を取得します
Dim daysInMonth As Integer = e.Day.Month.DaysInMonth
Dim elapsed As Double = e.Day.DayNumber / daysInMonth
elapsed *= 100
info += "The new ActiveDay is approximately " + elapsed.ToString("n") + "% of the way into the month." + vbCrLf
' 年数を取得します
info += "The new ActiveDay is in the year " + e.Day.Month.Year.YearNumber.ToString() + vbCrLf
' 年に ActiveDay の位置を取得します
Dim daysInYear As Integer = 365
If e.Day.Month.Year.IsLeapYear Then daysInYear = 366
elapsed = e.Day.DayOfYear / daysInYear
elapsed *= 100
info += "The new ActiveDay is approximately " + elapsed.ToString("n") + "% of the way into the year." + vbCrLf
' アクティビティがある場合、各のタイプの数を表示します
If e.Day.HasActivity Then
Dim activity As String = String.Empty
If (e.Day.Appointments.Count > 0) Then activity += e.Day.Appointments.Count.ToString() + " Appointment(s)" + vbCrLf
If (e.Day.Holidays.Count > 0) Then activity += e.Day.Holidays.Count.ToString() + " Holiday(s)" + vbCrLf
If (e.Day.Notes.Count > 0) Then activity += e.Day.Notes.Count.ToString() + " Note(s)" + vbCrLf
info += "There is activity for the new ActiveDay :" + vbCrLf + vbCrLf
info += activity + vbCrLf
End If
' 日が有効されたかどうかを表示します
If (e.Day.Enabled) Then
info += "The new ActiveDay is enabled." + vbCrLf
Else
info += "The new ActiveDay is disabled." + vbCrLf
End If
' 日が選択されたかどうかを表示します
If (e.Day.Selected) Then
info += "The new ActiveDay is selected." + vbCrLf
' 情報を表示します
MessageBox.Show(info, "ActiveDay information")
End If
End Sub