'宣言 Public Property AcceptsFocus As Infragistics.Win.DefaultableBoolean
public Infragistics.Win.DefaultableBoolean AcceptsFocus {get; set;}
0 – Default に設定すると、コントロール スタイルが '1 – Listbar'、'2 – Toolbox'、および '3 – OutlookNavigationPane' の場合は False に解決されます。コントロールスタイルが"0 – Explorer Bar"および"4 - VisualStudio2005Toolbox"の場合は True に解決されます。
フォーカスを受け取るかどうかについては、コントロールの TabStop プロパティも関係します。TabStop プロパティを False に設定するとコントロールにタブ移動できなくなるため、キーボードによってコントロールにフォーカスを与えることはできません。
TabStop プロパティが True に設定されている場合、またはコントロールがクリックされた場合は、AcceptsFocus プロパティによって、UltraExplorerBar にフォーカスが与えられるかどうかが決定されます。
Imports System.Diagnostics Imports Infragistics.Win Imports Infragistics.Win.UltraWinExplorerBar Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click ' Set the AcceptsFocus property to 'Default', then test AcceptsFocusResolved below for each ' of the control styles. Me.ultraExplorerBar1.AcceptsFocus = DefaultableBoolean.Default ' When we set the control style to ExplorerBar, AcceptsFocusResolved will return true. Me.ultraExplorerBar1.Style = UltraExplorerBarStyle.ExplorerBar Debug.WriteLine("AcceptsFocusResolved = " + Me.ultraExplorerBar1.AcceptsFocusResolved.ToString()) ' When we set the control style to Listbar, AcceptsFocusResolved will return false. Me.ultraExplorerBar1.Style = UltraExplorerBarStyle.Listbar Debug.WriteLine("AcceptsFocusResolved = " + Me.ultraExplorerBar1.AcceptsFocusResolved.ToString()) ' When we set the control style to Toolbox, AcceptsFocusResolved will return false. Me.ultraExplorerBar1.Style = UltraExplorerBarStyle.Toolbox Debug.WriteLine("AcceptsFocusResolved = " + Me.ultraExplorerBar1.AcceptsFocusResolved.ToString()) ' Of course, we can explicitly set the AcceptsFocus property to either true or false for ' any control style to override the default. Me.ultraExplorerBar1.AcceptsFocus = DefaultableBoolean.True ' When we set the control style to Listbar, AcceptsFocusResolved now returns true Me.ultraExplorerBar1.Style = UltraExplorerBarStyle.Listbar Debug.WriteLine("AcceptsFocusResolved = " + Me.ultraExplorerBar1.AcceptsFocusResolved.ToString()) End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinExplorerBar; private void button1_Click(object sender, System.EventArgs e) { // Set the AcceptsFocus property to 'Default', then test AcceptsFocusResolved below for each // of the control styles. this.ultraExplorerBar1.AcceptsFocus = DefaultableBoolean.Default; // When we set the control style to ExplorerBar, AcceptsFocusResolved will return true. this.ultraExplorerBar1.Style = UltraExplorerBarStyle.ExplorerBar; Debug.WriteLine("AcceptsFocusResolved = " + this.ultraExplorerBar1.AcceptsFocusResolved.ToString()); // When we set the control style to Listbar, AcceptsFocusResolved will return false. this.ultraExplorerBar1.Style = UltraExplorerBarStyle.Listbar; Debug.WriteLine("AcceptsFocusResolved = " + this.ultraExplorerBar1.AcceptsFocusResolved.ToString()); // When we set the control style to Toolbox, AcceptsFocusResolved will return false. this.ultraExplorerBar1.Style = UltraExplorerBarStyle.Toolbox; Debug.WriteLine("AcceptsFocusResolved = " + this.ultraExplorerBar1.AcceptsFocusResolved.ToString()); // Of course, we can explicitly set the AcceptsFocus property to either true or false for // any control style to override the default. this.ultraExplorerBar1.AcceptsFocus = DefaultableBoolean.True; // When we set the control style to Listbar, AcceptsFocusResolved now returns true; this.ultraExplorerBar1.Style = UltraExplorerBarStyle.Listbar; Debug.WriteLine("AcceptsFocusResolved = " + this.ultraExplorerBar1.AcceptsFocusResolved.ToString()); }