'宣言 Protected Overrides Sub OnAfterDisplayMonthPopup( _ ByVal e As AfterDisplayMonthPopupEventArgs _ )
protected override void OnAfterDisplayMonthPopup( AfterDisplayMonthPopupEventArgs e )
イベントが発生すると、デリゲートを通じてイベント ハンドラーが呼び出されます。
OnAfterDisplayMonthPopup メソッドを使用すれば、デリゲートを関連付けなくても、派生クラスでイベントを処理できます。これは、派生クラスでイベントを処理する際によく用いられる手法です。
継承時の注意: 派生クラスで OnAfterDisplayMonthPopup をオーバーライドする場合は、登録されたデリゲートがイベントを受信できるようにするため、必ず基本クラスの OnAfterDisplayMonthPopup メソッドを呼び出してください。
Private Sub ultraMonthViewMulti1_AfterDisplayMonthPopup(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.AfterDisplayMonthPopupEventArgs) Handles ultraMonthViewMulti1.AfterDisplayMonthPopup ' Get the name of the month for which the popup was displayed Dim oldMonthName As String = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthNames(e.Month.MonthNumber - 1) ' Get the name of the month that was scrolled to Dim newMonthName As String = String.Empty If (Not e.MonthScrollingTo Is Nothing) Then ' Ge the name of the month we are scrolling to newMonthName = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthNames(e.MonthScrollingTo.MonthNumber - 1) ' Output information about the event to the debugger Dim info As String = String.Empty info = "The popup was displayed for the month of " + oldMonthName + vbCrLf info += "The popup was scrolled to the month of " + newMonthName + vbCrLf System.Diagnostics.Debug.WriteLine(info) End If End Sub
private void ultraMonthViewMulti1_AfterDisplayMonthPopup(object sender, Infragistics.Win.UltraWinSchedule.AfterDisplayMonthPopupEventArgs e) { // Get the name of the month for which the popup was displayed string oldMonthName = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthNames[ e.Month.MonthNumber -1 ]; // Get the name of the month that was scrolled to string newMonthName = string.Empty; if ( e.MonthScrollingTo != null ) { // Ge the name of the month we are scrolling to newMonthName = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthNames[ e.MonthScrollingTo.MonthNumber -1 ]; // Output information about the event to the debugger string info = string.Empty; info = "The popup was displayed for the month of " + oldMonthName + "\n"; info += "The popup was scrolled to the month of " + newMonthName + "\n"; System.Diagnostics.Debug.WriteLine( info ); } }