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