'宣言 Protected Overrides Sub OnBeforeMonthScroll( _ ByVal e As BeforeMonthScrollEventArgs _ )
protected override void OnBeforeMonthScroll( BeforeMonthScrollEventArgs e )
イベントが発生すると、デリゲートを通じてイベント ハンドラーが呼び出されます。
OnBeforeMonthScroll メソッドを使用すれば、デリゲートを関連付けなくても、派生クラスでイベントを処理できます。これは、派生クラスでイベントを処理する際によく用いられる手法です。
継承時の注意: 派生クラスで OnBeforeMonthScroll をオーバーライドする場合は、登録されたデリゲートがイベントを受信できるようにするため、必ず基本クラスの OnBeforeMonthScroll メソッドを呼び出してください。
Private Sub ultraMonthViewMulti1_BeforeMonthScroll(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinSchedule.BeforeMonthScrollEventArgs) Handles ultraMonthViewMulti1.BeforeMonthScroll ' The BeforeMonthScroll event is a "cancelable" event, ' which means that the action to which it corresponds can be ' prevented from happening by canceling the event. ' ' Canceling an event is very simple - just set the 'Cancel' ' property of the event arguments to true. The action will then ' be prevented from happening, and the corresponding "After" ' event will not fire. ' If the new first visible month is not in the current year, ' cancel the event If (e.NewFirstMonth.Year.YearNumber <> DateTime.Today.Year) Then e.Cancel = True End If End Sub
private void ultraMonthViewMulti1_BeforeMonthScroll(object sender, Infragistics.Win.UltraWinSchedule.BeforeMonthScrollEventArgs e) { // The BeforeMonthScroll event is a "cancelable" event, // which means that the action to which it corresponds can be // prevented from happening by canceling the event. // // Canceling an event is very simple - just set the 'Cancel' // property of the event arguments to true. The action will then // be prevented from happening, and the corresponding "After" // event will not fire. // If the new first visible month is not in the current year, // cancel the event if ( e.NewFirstMonth.Year.YearNumber != DateTime.Today.Year ) e.Cancel = true; }