バージョン

SetEnabled(UltraTabControlEventGroup,Boolean) メソッド

グループ内のすべてのイベントを有効または無効に設定します。
シンタックス
'宣言
 
Public Overloads Sub SetEnabled( _
   ByVal group As UltraTabControlEventGroup, _
   ByVal enabled As Boolean _
) 
public void SetEnabled( 
   UltraTabControlEventGroup group,
   bool enabled
)

パラメータ

group
イベントのグループを有効/無効に指定する列挙体。
enabled
イベントを有効 (True) または無効 (False) のいずれかに指定するブール値。
解説

イベントを無効にすると、コントロールの内部操作に影響しません。無効にすると、プログラマが入力したコードが発生しないように、コントロールにイベント ハンドラーを呼び出さないように指示するだけです。

たとえば、Click を無効にすると、クリックした時にコントロールが Active Node を変更しないようにします。コントロールがクリックされた時に Click Event が発生しなくなるだけです。

使用例
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinTabs
Imports Infragistics.Win.UltraWinTabControl

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    ' Get the tab controls'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 UltraTabControlEventManager

    eventManager = Me.ultraTabControl1.EventManager

    ' Disable the ActiveTabChanging\Changed and SelectedTabChanging\Changed events
    eventManager.SetEnabled(UltraTabControlEventId.ActiveTabChanging, False)
    eventManager.SetEnabled(UltraTabControlEventId.ActiveTabChanged, False)
    eventManager.SetEnabled(UltraTabControlEventId.SelectedTabChanging, False)
    eventManager.SetEnabled(UltraTabControlEventId.SelectedTabChanged, False)

    ' Call PerformAction to select the next tab.
    ' Note: This would normally cause the ActiveTabChanging\Changed 
    ' and SelectedTabChanging\Changed events to be raised. 
    ' However, since the above code disabled the events they won't be.
    Me.ultraTabControl1.PerformAction(UltraTabControlAction.SelectNextTab)

    ' Re-enable the events
    eventManager.SetEnabled(UltraTabControlEventId.ActiveTabChanging, True)
    eventManager.SetEnabled(UltraTabControlEventId.ActiveTabChanged, True)
    eventManager.SetEnabled(UltraTabControlEventId.SelectedTabChanging, True)
    eventManager.SetEnabled(UltraTabControlEventId.SelectedTabChanged, 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 = False Then
        eventManager.AllEventsEnabled = True
    End If

    ' The event manager also exposes an 'IsEnabled' method
    ' to see if an event is enabled or disbled.
    If eventManager.IsEnabled(UltraTabControlEventId.ActiveTabChanging) = False Then
        eventManager.SetEnabled(UltraTabControlEventId.ActiveTabChanging, True)
    End If

    ' The 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(UltraTabControlEventGroup.BeforeEvents) = False Then
        eventManager.SetEnabled(UltraTabControlEventGroup.BeforeEvents, True)
    End If

    eventManager.SetEnabled(UltraTabControlEventGroup.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(UltraTabControlEventId.SelectedTabChanging) = True Then

        ' ... 

    End If

End Sub
using System.Diagnostics;
using Infragistics.Win;
using Infragistics.Win.UltraWinTabs;
using Infragistics.Win.UltraWinTabControl;

private void button1_Click(object sender, System.EventArgs e)
{

	// Get the tab controls'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.
	UltraTabControlEventManager eventManager = this.ultraTabControl1.EventManager;

	// Disable the ActiveTabChanging\Changed and SelectedTabChanging\Changed events
	eventManager.SetEnabled( UltraTabControlEventId.ActiveTabChanging, false );
	eventManager.SetEnabled( UltraTabControlEventId.ActiveTabChanged, false );
	eventManager.SetEnabled( UltraTabControlEventId.SelectedTabChanging, false );
	eventManager.SetEnabled( UltraTabControlEventId.SelectedTabChanged, false );

	// Call PerformAction to select the next tab.
	// Note: This would normally cause the ActiveTabChanging\Changed 
	// and SelectedTabChanging\Changed events to be raised. 
	// However, since the above code disabled the events they won't be.
	this.ultraTabControl1.PerformAction( UltraTabControlAction.SelectNextTab );

	// Re-enable the events
	eventManager.SetEnabled( UltraTabControlEventId.ActiveTabChanging, true );
	eventManager.SetEnabled( UltraTabControlEventId.ActiveTabChanged, true );
	eventManager.SetEnabled( UltraTabControlEventId.SelectedTabChanging, true );
	eventManager.SetEnabled( UltraTabControlEventId.SelectedTabChanged, 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(UltraTabControlEventId.ActiveTabChanging ) )
		eventManager.SetEnabled(UltraTabControlEventId.ActiveTabChanging, true );

	// The 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(UltraTabControlEventGroup.BeforeEvents ) )
		eventManager.SetEnabled(UltraTabControlEventGroup.BeforeEvents, true );

	eventManager.SetEnabled(UltraTabControlEventGroup.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( UltraTabControlEventId.SelectedTabChanging ) )
	{
		// ... 
	}
}
参照