'宣言 Public ReadOnly Property MonthOfTheYear As YearMonthEnum
public YearMonthEnum MonthOfTheYear {get;}
Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Private Sub GetMonthOfYearInfo() Dim info As String = String.Empty ' Iterate the component's MonthsOfYear collection Dim monthOfYear As Infragistics.Win.UltraWinSchedule.MonthOfYear For Each monthOfYear In Me.ultraCalendarInfo1.MonthsOfYear ' Display the month number and its long name Dim monthNumber As Integer = monthOfYear.MonthOfTheYear info += "Month number " + monthNumber.ToString() + " is named " + monthOfYear.LongDescriptionResolved info += "Its abbreviated name is: " + monthOfYear.ShortDescriptionResolved If monthOfYear.LongDescription <> String.Empty Then info += "The name of the month has been changed to '" + monthOfYear.LongDescription + "'" + vbCrLf End If If monthOfYear.ShortDescription <> String.Empty Then info += "The abbreviated name of the month has been changed to '" + monthOfYear.ShortDescription + "'" + vbCrLf End If ' Display whether the month is enabled If (monthOfYear.Enabled) Then info += " (Enabled)" + vbCrLf Else info += " (Disabled)" + vbCrLf End If Next MessageBox.Show(info, "GetMonthOfYearInfo", MessageBoxButtons.OK) End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; private void GetMonthOfYearInfo() { string info = string.Empty; // Iterate the component's MonthsOfYear collection foreach ( Infragistics.Win.UltraWinSchedule.MonthOfYear monthOfYear in this.ultraCalendarInfo1.MonthsOfYear ) { // Display the month number and its long name info += "Month number " + ((int)(monthOfYear.MonthOfTheYear)).ToString() + " is named " + monthOfYear.LongDescriptionResolved; info += "Its abbreviated name is: " + monthOfYear.ShortDescriptionResolved; if ( monthOfYear.LongDescription != string.Empty ) info += "The name of the month has been changed to '" + monthOfYear.LongDescription + "'" + "\n"; if ( monthOfYear.ShortDescription != string.Empty ) info += "The abbreviated name of the month has been changed to '" + monthOfYear.ShortDescription + "'" + "\n"; // Display whether the month is enabled if ( monthOfYear.Enabled ) info += " (Enabled)" + "\n"; else info += " (Disabled)"+ "\n"; } MessageBox.Show( info, "GetMonthOfYearInfo", MessageBoxButtons.OK ); }