'宣言 Public Delegate Sub AfterActiveDayChangedEventHandler( _ ByVal sender As Object, _ ByVal e As AfterActiveDayChangedEventArgs _ )
public delegate void AfterActiveDayChangedEventHandler( object sender, AfterActiveDayChangedEventArgs e )
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
using System.Diagnostics; using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; private void ultraCalendarInfo1_AfterActiveDayChanged(object sender, Infragistics.Win.UltraWinSchedule.AfterActiveDayChangedEventArgs e) { //---------------------------------------------------------------------------------------------------- // 説明 // AfterActiveDayChanged // // コンポーネントの 'ActiveDay' が変更された後に発生します // ActiveDay は、フォーカスを持つ日であると考えることができます // 一度に 1 つのみのアクティブ日があるわけです // //---------------------------------------------------------------------------------------------------- string info = string.Empty; // 新しい ActiveDay の日付を取得します info += "The date of the new ActiveDay is " + e.Day.Date.ToLongDateString() + ".\n"; // 新しい ActiveDay の曜日を取得します info += "The new ActiveDay falls on a " + e.Day.DayOfWeek.DayOfTheWeek.ToString() + ".\n"; // ActiveDay の週番号を取得します info += "The new ActiveDay falls in week number " + e.Day.Week.WeekNumber.ToString() + " of the year.\n"; // 月に日付の数を取得し、月の名前を取得します string monthName = 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 + ".\n"; // 月に ActiveDay の位置を取得します int daysInMonth = e.Day.Month.DaysInMonth; double elapsed = (double)(e.Day.DayNumber) / (double)(daysInMonth); elapsed *= 100; info += "The new ActiveDay is approximately " + elapsed.ToString("n") + "% of the way into the month.\n"; // 年数を取得します info += "The new ActiveDay is in the year " + e.Day.Month.Year.YearNumber.ToString() + ".\n"; // 年に ActiveDay の位置を取得します int daysInYear = e.Day.Month.Year.IsLeapYear ? 366 : 365; elapsed = (double)(e.Day.DayOfYear) / (double)(daysInYear); elapsed *= 100; info += "The new ActiveDay is approximately " + elapsed.ToString("n") + "% of the way into the year.\n"; // アクティビティがある場合、各のタイプの数を表示します if ( e.Day.HasActivity ) { string activity = string.Empty; if ( e.Day.Appointments.Count > 0 ) activity += e.Day.Appointments.Count.ToString() + " Appointment(s)\n"; if ( e.Day.Holidays.Count > 0 ) activity += e.Day.Holidays.Count.ToString() + " Holiday(s)\n"; if ( e.Day.Notes.Count > 0 ) activity += e.Day.Notes.Count.ToString() + " Note(s)\n"; info += "There is activity for the new ActiveDay :\n\n"; info += activity + "\n"; } // 日が有効されたかどうかを表示します if ( e.Day.Enabled ) info += "The new ActiveDay is enabled.\n"; else info += "The new ActiveDay is disabled.\n"; // 日が選択されたかどうかを表示します if ( e.Day.Selected ) info += "The new ActiveDay is selected.\n"; // 情報を表示します MessageBox.Show( info, "ActiveDay information" ); }