'宣言 Public Overloads Sub SetEnabled( _ ByVal group As StatusBarEventGroups, _ ByVal enabled As Boolean _ )
public void SetEnabled( StatusBarEventGroups group, bool enabled )
Imports Infragistics.Win.UltraWinStatusBar Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click ' Get the status bar 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 StatusBarEventManager eventManager = Me.ultraStatusBar1.EventManager ' Disable the PanelClick event eventManager.SetEnabled(StatusBarEventIds.ButtonClick, False) ' Toggle the 'Checked' property of a state button style panel. ' Note: This would normally cause the ButtonClick events to ' be raised. However, since the above code disabled the event ' it won't be. Me.ultraStatusBar1.Panels("P6").Checked = Not Me.ultraStatusBar1.Panels("P6").Checked() ' Re-enable the PanelClick event eventManager.SetEnabled(StatusBarEventIds.ButtonClick, 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(StatusBarEventIds.ButtonClick) Then eventManager.SetEnabled(StatusBarEventIds.ButtonClick, True) End If ' The status bar event manager also exposes overloaded ' 'IsEnabled' and 'SetEnabled' methods that take an ' event group so that, for example all 'Before' or all ' 'After' events can be enabled/disabled. If any event ' in the group is disabled the 'IsEnabled' method returns ' false. If Not eventManager.IsEnabled(StatusBarEventGroups.BeforeEvents) Then eventManager.SetEnabled(StatusBarEventGroups.BeforeEvents, True) End If eventManager.SetEnabled(StatusBarEventGroups.AfterEvents, 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(StatusBarEventIds.ButtonClick) Then ' ... End If End Sub
using Infragistics.Win.UltraWinStatusBar; private void button1_Click(object sender, System.EventArgs e) { // Get the status bar 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. StatusBarEventManager eventManager = this.ultraStatusBar1.EventManager; // Disable the PanelClick event eventManager.SetEnabled( StatusBarEventIds.ButtonClick, false ); // Toggle the 'Checked' property of a state button style panel. // Note: This would normally cause the ButtonClick events to // be raised. However, since the above code disabled the event // it won't be. this.ultraStatusBar1.Panels[0].Checked = !this.ultraStatusBar1.Panels[0].Checked; // Re-enable the PanelClick event eventManager.SetEnabled( StatusBarEventIds.ButtonClick, 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(StatusBarEventIds.ButtonClick ) ) eventManager.SetEnabled(StatusBarEventIds.ButtonClick, true ); // The status bar event manager also exposes overloaded // 'IsEnabled' and 'SetEnabled' methods that take an // event group so that, for example all 'Before' or all // 'After' events can be enabled/disabled. If any event // in the group is disabled the 'IsEnabled' method returns // false. if ( !eventManager.IsEnabled(StatusBarEventGroups.BeforeEvents ) ) eventManager.SetEnabled(StatusBarEventGroups.BeforeEvents, true ); eventManager.SetEnabled(StatusBarEventGroups.AfterEvents, 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( StatusBarEventIds.ButtonClick ) ) { // ... } }