'宣言 Public Class VisibleTabsCollection Implements Infragistics.Win.UIAutomation.IProvideUIAutomation
public class VisibleTabsCollection : Infragistics.Win.UIAutomation.IProvideUIAutomation
このコレクションには、Visible プロパティ値が False である UltraTab も含めて、UltraTabsCollection と同じ UltraTab が含まれます。
ただし、このコレクション内のタブの順序は、UltraTabsCollection コレクション内のタブの順序と異なる場合があります。このコレクション内の順序によって、タブの表示順序が決まります。
注: 複数行の Style では、UltraTab.VisibleIndex の値が小さい UltraTab ほど、コントロールのタブページ領域に近い位置にあります。
インデクサーが提供されており、0 から始まる UltraTab.VisibleIndex 値または UltraTab.Key 値を使用して個々の UltraTab にアクセスできます。
キーはサポートされていますが、必須ではありません。ただし、キーを使用する場合は一意にする必要があります。
AllowTabMoving プロパティが True に設定されていれば、実行時にタブをドラッグすることでタブの順序を変更できます。
その他にも、Sort メソッドを呼び出す、UltraTab の UltraTab.VisibleIndex プロパティを設定する、UltraTab.Reposition メソッドを呼び出す、などの方法でタブの順序を変更できます。
注: このコレクション内のタブは、データソースにバインドされた UltraTabStripControl では自動的に並べ替えられ、SortMember プロパティ値が設定されます。
Imports Infragistics.Win Imports Infragistics.Win.UltraWinTabs Imports Infragistics.Win.UltraWinTabControl Private Sub button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button7.Click ' Call the scroll method to cause tabs to scroll. ' Note: this does not change the ActiveTab or the ' SelectedTab even if they end up being scrolled ' out of view Me.ultraTabControl1.Scroll(ScrollType.Next) ' The following code will cause the tab to be scrolled ' completely into view. If it was already in view ' the method does nothing. Me.ultraTabControl1.VisibleTabs(2).EnsureTabInView() Dim sb As System.Text.StringBuilder Dim tab As UltraTab ' Loop over the 'VisibleTabs'. This collection contains ' the same tabs as in the 'Tabs' collection but maintains ' them in the order they are displayed visually. This ' includes tabs whose 'Visible' property is false. For Each tab In Me.ultraTabControl1.VisibleTabs sb = New System.Text.StringBuilder() ' Check to see if this is the first displayed tab If tab Is Me.ultraTabControl1.FirstDisplayedTab Then sb.Append("First displayed tab: ") End If ' The Key property returns the key of the tab. The Tabs ' collection exposes an indexer that will return the ' tab based on its key value. For example 'Dim optionsTab As UltraTab = Me.ultraTabControl1.Tabs("Options") sb.Append("Key: ") sb.Append(tab.Key) ' The Text property returns the text that will be displayed ' on the tab sb.Append(", Text: ") sb.Append(tab.Text) ' The Index property returns the zero-based index of ' the tab in the Tabs collection sb.Append(", Index: ") sb.Append(tab.Index) ' The VisisbleIndex property returns the zero-based ' index of the tab in the VisibleTabs collection sb.Append(", VisibleIndex: ") sb.Append(tab.VisibleIndex) ' The Visible property determines if the tab is ' displayed or hidden. sb.Append(", Visible: ") sb.Append(tab.Visible) ' The Enabled property determines if the tab can ' be selected. sb.Append(", Enabled: ") sb.Append(tab.Enabled) ' The IsInView property returns true only if the tab ' is completely in view sb.Append(", IsInView: ") sb.Append(tab.IsInView) ' The IsHotTracked property returns true only if the ' mouse is over the tab and the control's HotTrack ' property is true. ' Note: The 'IsHotTracked' compares the tab ' with the tab returned from the HotTrackedTab ' property (tab Is this.ultraTabControl1.HotTrackedTab). sb.Append(", IsHotTracked: ") sb.Append(tab.IsHotTracked) ' The Selected property returns true if this is ' the selected tab. This property can be set but ' only to true. It throws an error if set to false. sb.Append(", is the selected tab: ") sb.Append(tab.Selected) ' The Active property returns true if this is ' the active tab. This property can be set but ' only to true. It throws an error if set to false. sb.Append(", is the active tab: ") sb.Append(tab.Active) ' The 'IsMultiRow' property returns true if the ' 'Style' property is set to a multi-row style. If Me.ultraTabControl1.IsMultiRow = True Then ' The RowNumber property returns the 1-based ' overall row number (including rows that are ' scrolled out of view). sb.Append(", RowNumber: ") sb.Append(tab.RowNumber) End If Debug.WriteLine(sb.ToString()) Next End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinTabs; using Infragistics.Win.UltraWinTabControl; private void button7_Click(object sender, System.EventArgs e) { // Call the scroll method to cause tabs to scroll. // Note: this does not change the ActiveTab or the // SelectedTab even if they end up being scrolled // out of view this.ultraTabControl1.Scroll( ScrollType.Next ); // The following code will cause the tab to be scrolled // completely into view. If it was already in view // the method does nothing. this.ultraTabControl1.VisibleTabs[2].EnsureTabInView(); System.Text.StringBuilder sb; // Loop over the 'VisibleTabs'. This collection contains // the same tabs as in the 'Tabs' collection but maintains // them in the order they are displayed visually. This // includes tabs whose 'Visible' property is false. foreach ( UltraTab tab in this.ultraTabControl1.VisibleTabs ) { sb = new System.Text.StringBuilder(); // Check to see if this is the first displayed tab if ( tab == this.ultraTabControl1.FirstDisplayedTab ) sb.Append("First displayed tab: "); // The Key property returns the key of the tab. The Tabs // collection exposes an indexer that will return the // tab based on its key value. For example; //UltraTab optionsTab = this.ultraTabControl1.Tabs["Options"]; sb.Append( "Key: " ); sb.Append( tab.Key ); // The Text property returns the text that will be displayed // on the tab sb.Append( ", Text: " ); sb.Append( tab.Text ); // The Index property returns the zero-based index of // the tab in the Tabs collection sb.Append( ", Index: " ); sb.Append( tab.Index ); // The VisisbleIndex property returns the zero-based // index of the tab in the VisibleTabs collection sb.Append( ", VisibleIndex: " ); sb.Append( tab.VisibleIndex ); // The Visible property determines if the tab is // displayed or hidden. sb.Append( ", Visible: " ); sb.Append( tab.Visible ); // The Enabled property determines if the tab can // be selected. sb.Append( ", Enabled: " ); sb.Append( tab.Enabled ); // The IsInView property returns true only if the tab // is completely in view sb.Append( ", IsInView: " ); sb.Append( tab.IsInView ); // The IsHotTracked property returns true only if the // mouse is over the tab and the control's HotTrack // property is true. // Note: The 'IsHotTracked' compares the tab // with the tab returned from the HotTrackedTab // property (tab == this.ultraTabControl1.HotTrackedTab). sb.Append( ", IsHotTracked: " ); sb.Append( tab.IsHotTracked ); // The Selected property returns true if this is // the selected tab. This property can be set but // only to true. It throws an error if set to false. sb.Append( ", is the selected tab: " ); sb.Append( tab.Selected ); // The Active property returns true if this is // the active tab. This property can be set but // only to true. It throws an error if set to false. sb.Append( ", is the active tab: " ); sb.Append( tab.Active ); // The 'IsMultiRow' property returns true if the // 'Style' property is set to a multi-row style. if ( this.ultraTabControl1.IsMultiRow ) { // The RowNumber property returns the 1-based // overall row number (including rows that are // scrolled out of view). sb.Append( ", RowNumber: " ); sb.Append( tab.RowNumber ); } Debug.WriteLine(sb.ToString()); } }