注:PatternFrequency プロパティが 「Yearly」 に設定されているときには、PatternMonthOfYear プロパティは適用できません。
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports System.Diagnostics Private Sub CreateYearlyAppointment() ' the 'PatternMonthOfYear' is only used by Yearly ' recurring appointments and is used by both explicit ' and implicit yearly appointments ' For an explicit yearly appointment (i.e. one that falls on ' a specific month/day combination in the year), the ' 'PatternMonthOfYear' will indicate the specific month ' of the year on which the occurrence will fall. this is ' used in conjunction with the 'PatternDayOfMonth', which ' specifies which day of that month will be the start of ' the occurrence. ' ' create a new appointment Dim dt As DateTime = DateTime.Now Dim expAppt As Appointment = Me.ultraCalendarInfo1.Appointments.Add(dt, dt.AddHours(3D), String.Empty) ' create the recurrence object - this appointment ' will become the rootappointment (or representation ' of the series) - it's 'IsRecurringAppointmentRoot' ' will return true and it will not displayed in ' the associated controls. instead, instances or ' occurrences of the recurrence will appear in the ' the controls associated with the calendar info. expAppt.Recurrence = New AppointmentRecurrence() ' the pattern frequency indicates how often the ' recurrence occurs. in this case, it will occur ' yearly... expAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Yearly ' a yearly recurring appt can have an explicit ' dt pattern - e.g. the 25th of every december expAppt.Recurrence.PatternMonthOfYear = 12 expAppt.Recurrence.PatternDayOfMonth = 25 ' its not necessary to set the patterntype in this case ' since explicit is the default 'expAppt.Recurrence.PatternType = RecurrencePatternType.Explicit; ' the description provides a description of the ' recurrence info. expAppt.Subject = "Christmas" ' The 'PatternMonthOfYear' is also used by calculated ' yearly appointments to indicate the month of the year ' that will contain the appointment ' ' create a new appointment Dim calcAppt As Appointment = Me.ultraCalendarInfo1.Appointments.Add(DateTime.Today, String.Empty) calcAppt.AllDayEvent = True ' create the recurrence object - this appointment ' will become the rootappointment (or representation ' of the series) - see above for more calcAppt.Recurrence = New AppointmentRecurrence() ' this is a yearly recurrence calcAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Yearly ' yearly appointments that do not fall on a specific ' day of a specific month need to be calculated so ' we need to set the 'PatternType' to indicate that ' the dates of the occurrences must be calculated calcAppt.Recurrence.PatternType = RecurrencePatternType.Calculated ' Just as with an explicit yearly appointment, the ' 'PatternMonthOfYear' specifies the month during which ' the occurrence will occur. in this example, we will ' be calculating when memorial day falls. since that ' falls in may, the 5th month, we'll set this to 5 calcAppt.Recurrence.PatternMonthOfYear = 5 ' The 'PatternOccurrenceOfDayInMonth' indicates the ' required relative information to determine when ' the occurrence should occur. since memorial day ' is the last monday in may, we'll set this to ' 'Last' and set the 'PatternDaysOfWeek' property ' to 'Monday'. ' calcAppt.Recurrence.PatternOccurrenceOfDayInMonth = RecurrencePatternOccurrenceOfDayInMonth.Last calcAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Monday ' the description provides a description of the recurrence info calcAppt.Subject = "Memorial Day" End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using System.Diagnostics; private void CreateYearlyAppointment() { // the 'PatternMonthOfYear' is only used by Yearly // recurring appointments and is used by both explicit // and implicit yearly appointments // For an explicit yearly appointment (i.e. one that falls on // a specific month/day combination in the year), the // 'PatternMonthOfYear' will indicate the specific month // of the year on which the occurrence will fall. this is // used in conjunction with the 'PatternDayOfMonth', which // specifies which day of that month will be the start of // the occurrence. // // create a new appointment DateTime dt = DateTime.Now; Appointment expAppt = this.ultraCalendarInfo1.Appointments.Add(dt, dt.AddHours(3d), string.Empty); // create the recurrence object - this appointment // will become the rootappointment (or representation // of the series) - it's 'IsRecurringAppointmentRoot' // will return true and it will not displayed in // the associated controls. instead, instances or // occurrences of the recurrence will appear in the // the controls associated with the calendar info. expAppt.Recurrence = new AppointmentRecurrence(); // the pattern frequency indicates how often the // recurrence occurs. in this case, it will occur // yearly... expAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Yearly; // a yearly recurring appt can have an explicit // dt pattern - e.g. the 25th of every december expAppt.Recurrence.PatternMonthOfYear = 12; expAppt.Recurrence.PatternDayOfMonth = 25; // its not necessary to set the patterntype in this case // since explicit is the default //expAppt.Recurrence.PatternType = RecurrencePatternType.Explicit; // the description provides a description of the // recurrence info. expAppt.Subject = "Christmas"; // The 'PatternMonthOfYear' is also used by calculated // yearly appointments to indicate the month of the year // that will contain the appointment // // create a new appointment Appointment calcAppt = this.ultraCalendarInfo1.Appointments.Add(DateTime.Today, string.Empty); calcAppt.AllDayEvent = true; // create the recurrence object - this appointment // will become the rootappointment (or representation // of the series) - see above for more calcAppt.Recurrence = new AppointmentRecurrence(); // this is a yearly recurrence calcAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Yearly; // yearly appointments that do not fall on a specific // day of a specific month need to be calculated so // we need to set the 'PatternType' to indicate that // the dates of the occurrences must be calculated calcAppt.Recurrence.PatternType = RecurrencePatternType.Calculated; // Just as with an explicit yearly appointment, the // 'PatternMonthOfYear' specifies the month during which // the occurrence will occur. in this example, we will // be calculating when memorial day falls. since that // falls in may, the 5th month, we'll set this to 5 calcAppt.Recurrence.PatternMonthOfYear = 5; // The 'PatternOccurrenceOfDayInMonth' indicates the // required relative information to determine when // the occurrence should occur. since memorial day // is the last monday in may, we'll set this to // 'Last' and set the 'PatternDaysOfWeek' property // to 'Monday'. // calcAppt.Recurrence.PatternOccurrenceOfDayInMonth = RecurrencePatternOccurrenceOfDayInMonth.Last; calcAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Monday; // the description provides a description of the recurrence info calcAppt.Subject = "Memorial Day"; }