'宣言 Public Class UltraScrollBarEventManager Inherits Infragistics.Shared.EventManagerBase
public class UltraScrollBarEventManager : Infragistics.Shared.EventManagerBase
Imports Infragistics.Win Imports Infragistics.Win.UltraWinScrollBar Private Sub button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button3.Click ' Get the scrollbar control's event manager. ' The event manager is used to temporarily disable events ' to prevent them from being raised. This can be very ' convenient in a situation where one or more properties ' are being set in code and the events they would normally ' raise would cause unnecessary or counter-productive ' code to be executed. ' ' Note: All events are enabled by default. Dim eventManager As UltraScrollBarEventManager eventManager = Me.ultraScrollBar1.EventManager ' Disable the ValueChanged event eventManager.SetEnabled(UltraScrollBarEventIds.ValueChanged, False) ' Call the PerformAction to scroll down. ' Note: This would normally cause the 'ValueChanged' event to ' be raised. However, since the above code disabled the event ' it won't be. Me.ultraScrollBar1.PerformAction(ScrollBarAction.SmallIncrement) ' Re-enable the ValueChanged event eventManager.SetEnabled(UltraScrollBarEventIds.ValueChanged, True) ' The 'AllEventsEnabled' property lets you enable/disable ' all events will a single line of code. If any event is ' disabled the 'AllEventsEnabled' property returns false. If Not eventManager.AllEventsEnabled Then eventManager.AllEventsEnabled = True End If ' The event manager also exposes an 'IsEnabled' method ' to see if an event is enabled or disbled. If Not eventManager.IsEnabled(UltraScrollBarEventIds.ValueChanged) Then eventManager.SetEnabled(UltraScrollBarEventIds.ValueChanged, True) End If ' The 'InProgress' method will return true if the ' specified event is currently being raised. This ' is often helpful in methods that can be called ' from various points in an application to determine ' what is triggering the call. If eventManager.InProgress(UltraScrollBarEventIds.ValueChanged) Then ' ... End If End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinScrollBar; private void button3_Click(object sender, System.EventArgs e) { // Get the scrollbar control's event manager. // The event manager is used to temporarily disable events // to prevent them from being raised. This can be very // convenient in a situation where one or more properties // are being set in code and the events they would normally // raise would cause unnecessary or counter-productive // code to be executed. // // Note: All events are enabled by default. UltraScrollBarEventManager eventManager = this.ultraScrollBar1.EventManager; // Disable the ValueChanged event eventManager.SetEnabled(UltraScrollBarEventIds.ValueChanged, false ); // Call the PerformAction to scroll down. // Note: This would normally cause the 'ValueChanged' event to // be raised. However, since the above code disabled the event // it won't be. this.ultraScrollBar1.PerformAction( ScrollBarAction.SmallIncrement ); // Re-enable the ValueChanged event eventManager.SetEnabled( UltraScrollBarEventIds.ValueChanged, true ); // The 'AllEventsEnabled' property lets you enable/disable // all events will a single line of code. If any event is // disabled the 'AllEventsEnabled' property returns false. if ( !eventManager.AllEventsEnabled ) eventManager.AllEventsEnabled = true; // The event manager also exposes an 'IsEnabled' method // to see if an event is enabled or disbled. if ( !eventManager.IsEnabled( UltraScrollBarEventIds.ValueChanged ) ) eventManager.SetEnabled(UltraScrollBarEventIds.ValueChanged, true ); // The 'InProgress' method will return true if the // specified event is currently being raised. This // is often helpful in methods that can be called // from various points in an application to determine // what is triggering the call. if ( eventManager.InProgress( UltraScrollBarEventIds.ValueChanged ) ) { // ... } }