'宣言 Public ReadOnly Property Appointments As AppointmentsSubsetCollection
public AppointmentsSubsetCollection Appointments {get;}
Imports System.Diagnostics Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Private Sub GetMonthInfo() ' Create a month object for the current month Dim month As Infragistics.Win.UltraWinSchedule.Month = Me.ultraCalendarInfo1.GetMonth(DateTime.Today) Dim info As String = String.Empty ' Display the number of days in the month info += "The month has " + month.DaysInMonth.ToString() + " days." + vbCrLf ' Display whether the week's Enabled property is true or false If (month.Enabled) Then info += "The month's Enabled property is set to true." + vbCrLf Else info += "The month's Enabled property is set to false." + vbCrLf End If ' Display whether the month is effectively enabled ' ' Note that the EnabledResolved property accounts ' not only for the month's own Enabled property, but for the ' Enabled properties of all objects that encompass that month ' (i.e., Year) If (month.EnabledResolved) Then info += "The month is enabled." + vbCrLf Else info += "The month is disabled." + vbCrLf End If ' If there is activity, display the number of each type If (month.HasActivity) Then Dim activity As String = String.Empty If (month.Appointments.Count > 0) Then activity += month.Appointments.Count.ToString() + " Appointment(s)" + vbCrLf End If If (month.Holidays.Count > 0) Then activity += month.Holidays.Count.ToString() + " Holiday(s)" + vbCrLf End If If (month.Notes.Count > 0) Then activity += month.Notes.Count.ToString() + " Note(s)" + vbCrLf End If info += "There is activity for the month :" + vbCrLf info += activity + vbCrLf End If ' Display the month and year number Dim monthNumber As Integer Dim yearNumber As Integer monthNumber = month.MonthNumber yearNumber = month.Year.YearNumber info += "The month is month number " + monthNumber.ToString() + " of the year " + yearNumber.ToString() + vbCrLf ' Display the information MessageBox.Show(info, "GetMonthInfo") End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; private void GetMonthInfo() { // Create a month object for the current month Infragistics.Win.UltraWinSchedule.Month month = this.ultraCalendarInfo1.GetMonth( DateTime.Today ); string info = string.Empty; // Display the number of days in the month info += "The month has " + month.DaysInMonth.ToString() + " days." + "\n"; // Display whether the week's Enabled property is true or false if ( month.Enabled ) info += "The month's Enabled property is set to true.\n"; else info += "The month's Enabled property is set to false.\n"; // Display whether the month is effectively enabled // // Note that the EnabledResolved property accounts // not only for the month's own Enabled property, but for the // Enabled properties of all objects that encompass that month // (i.e., Year) if ( month.EnabledResolved ) info += "The month is enabled.\n"; else info += "The month is disabled.\n"; // If there is activity, display the number of each type if ( month.HasActivity ) { string activity = string.Empty; if ( month.Appointments.Count > 0 ) activity += month.Appointments.Count.ToString() + " Appointment(s)\n"; if ( month.Holidays.Count > 0 ) activity += month.Holidays.Count.ToString() + " Holiday(s)\n"; if ( month.Notes.Count > 0 ) activity += month.Notes.Count.ToString() + " Note(s)\n"; info += "There is activity for the month :\n\n"; info += activity + "\n"; } // Display the month and year number int monthNumber; int yearNumber; monthNumber = month.MonthNumber; yearNumber = month.Year.YearNumber; info += "The month is month number " + monthNumber.ToString() + " of the year " + yearNumber.ToString() + "\n"; // Display the information MessageBox.Show( info, "GetMonthInfo" ); }