注: PatternDayOfMonth プロパティが、定期的な予定に含まれるいずれかの月の日数を超える値に設定されている場合、その月の発生は月の最後の日になります。
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports System.Diagnostics Private Sub CreateMonthlyAndYearlyAppointment() ' the PatternDayOfMonth is used by explicit ' Monthly and Yearly recurring appointments ' For an explicit yearly appointment (i.e. one that falls on ' a specific month/day combination in the year), the ' 'PatternDayOfMonth' will indicate the specific day of ' the month on which the occurrences will occur; this is ' used in conjunction with the PatternMonthOfYear, which ' indicates which month of the year the occurrence will ' land on. ' ' create a new appointment Dim dt As DateTime = DateTime.Now Dim yrAppt 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. yrAppt.Recurrence = New AppointmentRecurrence() ' the pattern frequency indicates how often the ' recurrence occurs. in this case, it will occur ' yearly... yrAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Yearly ' a yearly recurring appt can have an explicit ' dt pattern - e.g. the 25th of every december yrAppt.Recurrence.PatternMonthOfYear = 12 yrAppt.Recurrence.PatternDayOfMonth = 25 ' its not necessary to set the patterntype in this case ' since explicit is the default 'appt.Recurrence.PatternType = RecurrencePatternType.Explicit; ' the description provides a description of the ' recurrence info. yrAppt.Subject = yrAppt.Recurrence.Description ' For an explicit monthly appointment (i.e. one that falls ' on a specific day every x months), the 'PatternDayOfMonth' ' will indicate which day on the month the appointment ' will occur. Note, if you specify a value that is greater ' then the number of the days in the month, the last ' day of that month will be used. ' ' create a new appointment Dim mthAppt 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) as mentioned above mthAppt.Recurrence = New AppointmentRecurrence() ' the pattern frequency indicates how often the ' recurrence occurs. in this case, it will occur ' every x months... mthAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Monthly ' the 'PatternInterval' in an explicit monthly recurrence ' will indicate how many months exist between each ' occurrence of the appointment. in this case, we ' want the appointment to occur every month mthAppt.Recurrence.PatternInterval = 1 ' if you were to set 'PatternDayOfMonth' to a value like 31, ' which is more days then exist in certain months, the ' occurrencesfor such months would fall on the last day ' of that month ' e.g. appt.Recurrence.PatternDayOfMonth = 31; ' in this case, we want the appt to occur on the ' first day of the month mthAppt.Recurrence.PatternDayOfMonth = 1 ' the description provides a description of the recurrence info mthAppt.Subject = mthAppt.Recurrence.Description End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using System.Diagnostics; private void CreateMonthlyAndYearlyAppointment() { // the PatternDayOfMonth is used by explicit // Monthly and Yearly recurring appointments // For an explicit yearly appointment (i.e. one that falls on // a specific month/day combination in the year), the // 'PatternDayOfMonth' will indicate the specific day of // the month on which the occurrences will occur; this is // used in conjunction with the PatternMonthOfYear, which // indicates which month of the year the occurrence will // land on. // // create a new appointment DateTime dt = DateTime.Now; Appointment yrAppt = 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. yrAppt.Recurrence = new AppointmentRecurrence(); // the pattern frequency indicates how often the // recurrence occurs. in this case, it will occur // yearly... yrAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Yearly; // a yearly recurring appt can have an explicit // dt pattern - e.g. the 25th of every december yrAppt.Recurrence.PatternMonthOfYear = 12; yrAppt.Recurrence.PatternDayOfMonth = 25; // its not necessary to set the patterntype in this case // since explicit is the default //appt.Recurrence.PatternType = RecurrencePatternType.Explicit; // the description provides a description of the // recurrence info. yrAppt.Subject = yrAppt.Recurrence.Description; // For an explicit monthly appointment (i.e. one that falls // on a specific day every x months), the 'PatternDayOfMonth' // will indicate which day on the month the appointment // will occur. Note, if you specify a value that is greater // then the number of the days in the month, the last // day of that month will be used. // // create a new appointment Appointment mthAppt = 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) as mentioned above mthAppt.Recurrence = new AppointmentRecurrence(); // the pattern frequency indicates how often the // recurrence occurs. in this case, it will occur // every x months... mthAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Monthly; // the 'PatternInterval' in an explicit monthly recurrence // will indicate how many months exist between each // occurrence of the appointment. in this case, we // want the appointment to occur every month mthAppt.Recurrence.PatternInterval = 1; // if you were to set 'PatternDayOfMonth' to a value like 31, // which is more days then exist in certain months, the // occurrencesfor such months would fall on the last day // of that month // e.g. appt.Recurrence.PatternDayOfMonth = 31; // in this case, we want the appt to occur on the // first day of the month mthAppt.Recurrence.PatternDayOfMonth = 1; // the description provides a description of the recurrence info mthAppt.Subject = mthAppt.Recurrence.Description; }