'宣言 Public ReadOnly Property Holidays As HolidaysCollection
public HolidaysCollection Holidays {get;}
Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports System.IO Imports System.Globalization Private Sub GetDayInfo() Dim info As String = String.Empty ' 現在の日付の Day オブジェクトを作成します Dim day As Infragistics.Win.UltraWinSchedule.Day = Me.ultraCalendarInfo1.GetDay(DateTime.Today, True) ' 現在の日に予定、休日、メモを追加します Me.ultraCalendarInfo1.Appointments.Add(day.Date, "Today's Appointment #1") Me.ultraCalendarInfo1.Appointments.Add(day.Date, "Today's Appointment #2") Me.ultraCalendarInfo1.Appointments.Add(day.Date, "Today's Appointment #3") Me.ultraCalendarInfo1.Holidays.Add(day.Date, "Today's Holiday") Me.ultraCalendarInfo1.Notes.Add(day.Date, "Today's Note #1") Me.ultraCalendarInfo1.Notes.Add(day.Date, "Today's Note #2") ' 日の日付を取得します info += "The date of the day is " + day.Date.ToLongDateString() + "." + vbCrLf ' 日の曜日を取得します info += "The day falls on a " + day.DayOfWeek.DayOfTheWeek.ToString() + "." + vbCrLf ' 日の週番号を取得します info += "The day falls in week number " + day.Week.WeekNumber.ToString() + " of the year." + vbCrLf ' 月の日数を取得し、月の名前を取得します Dim monthName As String = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthNames(day.Month.MonthNumber - 1) info += "The day is day number " + day.DayNumber.ToString() info += " in the month of " + monthName + "." + vbCrLf ' 月の日の位置を取得します Dim daysInMonth As Integer = day.Month.DaysInMonth Dim elapsed As Double = (day.DayNumber) / (daysInMonth) elapsed *= 100 info += "The day is approximately " + elapsed.ToString("n") + "% of the way into the month." + vbCrLf ' 年数を取得します info += "The day is in the year " + day.Month.Year.YearNumber.ToString() + "." + vbCrLf ' その年の日の位置を取得します Dim daysInYear As Integer = 365 If day.Month.Year.IsLeapYear Then daysInYear = 366 elapsed = (day.DayOfYear) / (daysInYear) elapsed *= 100 info += "The day is approximately " + elapsed.ToString("n") + "% of the way into the year." + vbCrLf ' アクティビティがある場合、日の Enabled プロパティは True または False であるかどうかを表示す If (day.HasActivity) Then Dim activity As String = String.Empty If (day.Appointments.Count > 0) Then activity += day.Appointments.Count.ToString() + " Appointment(s)" + vbCrLf End If If (day.Holidays.Count > 0) Then activity += day.Holidays.Count.ToString() + " Holiday(s)" + vbCrLf End If If (day.Notes.Count > 0) Then activity += day.Notes.Count.ToString() + " Note(s)" + vbCrLf End If info += "There is activity for the day :" + vbCrLf + vbCrLf info += activity + vbCrLf End If ' 各タイプの数を表示します If (day.Enabled) Then info += "The day's Enabled property is set to true." + vbCrLf Else info += "The day's Enabled property is set to false." + vbCrLf End If ' 日が結果的に有効化されたかどうかを表示します ' ' EnabledResolved プロパティは、日の Enabled プロパティだけでなく ' その日を含むオブジェクト (Week、Month、Year など) の ' Enabled プロパティによっても ' 影響されます If (day.EnabledResolved) Then info += "The day is enabled." + vbCrLf Else info += "The day is disabled." + vbCrLf End If ' 日が ActiveDay であるかどうかを表示します If Not Me.ultraCalendarInfo1.ActiveDay Is Nothing And Me.ultraCalendarInfo1.ActiveDay Is day Then info += "The day is the ActiveDay." + vbCrLf End If ' 日が選択されたかどうかを表示します If (day.Selected) Then info += "The day is selected." + vbCrLf End If ' 日がアクティブ化されているかを表示します If (day.Activated) Then info += "The day has been activated." + vbCrLf ' 情報を表示します MessageBox.Show(info, "GetDayInfo") End If End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using System.IO; using System.Globalization; private void GetDayInfo() { string info = string.Empty; // 現在の日付の Day オブジェクトを作成します Infragistics.Win.UltraWinSchedule.Day day = this.ultraCalendarInfo1.GetDay( DateTime.Today, true ); // 現在の日に予定、休日、メモを追加します this.ultraCalendarInfo1.Appointments.Add( day.Date, "Today's Appointment #1" ); this.ultraCalendarInfo1.Appointments.Add( day.Date, "Today's Appointment #2" ); this.ultraCalendarInfo1.Appointments.Add( day.Date, "Today's Appointment #3" ); this.ultraCalendarInfo1.Holidays.Add( day.Date, "Today's Holiday" ); this.ultraCalendarInfo1.Notes.Add( day.Date, "Today's Note #1" ); this.ultraCalendarInfo1.Notes.Add( day.Date, "Today's Note #2" ); // 日の日付を取得します info += "The date of the day is " + day.Date.ToLongDateString() + ".\n"; // 日の曜日を取得します info += "The day falls on a " + day.DayOfWeek.DayOfTheWeek.ToString() + ".\n"; // 日の週番号を取得します info += "The day falls in week number " + day.Week.WeekNumber.ToString() + " of the year.\n"; // 月の日数を取得し、月の名前を取得します string monthName = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthNames[ day.Month.MonthNumber -1 ]; info += "The day is day number " + day.DayNumber.ToString(); info += " in the month of " + monthName + ".\n"; // 月に日の位置を取得します int daysInMonth = day.Month.DaysInMonth; double elapsed = (double)(day.DayNumber) / (double)(daysInMonth); elapsed *= 100; info += "The day is approximately " + elapsed.ToString("n") + "% of the way into the month.\n"; // 年数を取得します info += "The day is in the year " + day.Month.Year.YearNumber.ToString() + ".\n"; // その年の日の位置を取得します int daysInYear = day.Month.Year.IsLeapYear ? 366 : 365; elapsed = (double)(day.DayOfYear) / (double)(daysInYear); elapsed *= 100; info += "The day is approximately " + elapsed.ToString("n") + "% of the way into the year.\n"; // アクティビティがある場合、日の Enabled プロパティは True または False であるかどうかを表示す if ( day.HasActivity ) { string activity = string.Empty; if ( day.Appointments.Count > 0 ) activity += day.Appointments.Count.ToString() + " Appointment(s)\n"; if ( day.Holidays.Count > 0 ) activity += day.Holidays.Count.ToString() + " Holiday(s)\n"; if ( day.Notes.Count > 0 ) activity += day.Notes.Count.ToString() + " Note(s)\n"; info += "There is activity for the day :\n\n"; info += activity + "\n"; } // 各タイプの数を表示します if ( day.Enabled ) info += "The day's Enabled property is set to true.\n"; else info += "The day's Enabled property is set to false.\n"; // 日が結果的に有効されたかどうかを表示します // // EnabledResolved プロパティは日の Enabled プロパティも // その日を含むオブジェクト (Week、Month、Year など) の // Enabled プロパティによって // 影響されます if ( day.EnabledResolved ) info += "The day is enabled.\n"; else info += "The day is disabled.\n"; // 日が ActiveDay であるかどうかを表示します if ( this.ultraCalendarInfo1.ActiveDay != null && this.ultraCalendarInfo1.ActiveDay == day ) info += "The day is the ActiveDay.\n"; // 日が選択されたかどうかを表示します if ( day.Selected ) info += "The day is selected.\n"; // 日がアクティブ化になったかどうかを表示します if ( day.Activated ) info += "The day has been activated.\n"; // 情報を表示します MessageBox.Show( info, "GetDayInfo" ); }