'宣言 Public Sub MoveAllTabs( _ ByVal relation As MdiTabGroupPosition _ )
public void MoveAllTabs( MdiTabGroupPosition relation )
MoveAllTabs メソッドは、すべての Tabs を別の MdiTabGroup に移動するために使用できます。Relationでは、新しいでは、新しい MdiTab オブジェクトを受け取る MdiTabGroup を指定します。これは、所有している Manager の TabGroups 内での、 MdiTabGroupオブジェクトの順序に基づきます。
注: 指定された relation によっては、タブが移動されない場合があります。たとえば、タブ グループが TabGroups コレクションの最初の項目の場合に、relationに First を指定すると、relation が同じ MdiTabGroup を指し示すため、何も変更されません。
Imports Infragistics.Win Imports Infragistics.Win.UltraWinTabs Imports Infragistics.Win.UltraWinTabbedMdi Private Sub MoveAllToFirstGroup() 'There are multiple ways to reposition a group. Which you use 'will depend upon what you are trying to accomplish although 'there are usually several mechanisms for achieving the 'desired result. Here we are moving all the tabs from all 'the tab groups into the first tab group. Several numbered 'but commented out ways are presented to complete the task. ' ' if there are no mdi tab groups, there is nothing to do If Not Me.ultraTabbedMdiManager1.HasTabGroups Then Return End If ' get the first group Dim firstGroup As MdiTabGroup = Me.ultraTabbedMdiManager1.TabGroups(0) Dim firstDisplayedTab As MdiTab = firstGroup.FirstDisplayedTab Dim selectedTab As MdiTab = firstGroup.SelectedTab Me.ultraTabbedMdiManager1.BeginUpdate() ' iterate through all the tab groups after ' the first one and move the tabs to the first group. ' we'll iterate backwards since removing all the tabs ' in a group causes the group to get removed ' Dim count As Integer = Me.ultraTabbedMdiManager1.TabGroups.Count - 1 Dim i As Integer For i = count To 1 Step - 1 Dim tabGroup As MdiTabGroup = Me.ultraTabbedMdiManager1.TabGroups(i) ' (1) The MoveAllTabs method is convenient to move all ' the contained tabs to an existing tabgroup. the ' MdiTabGroupPosition parameter is used to determine ' the tab group which tab group, relative to the ' calling tab group's current position 'tabGroup.MoveAllTabs(MdiTabGroupPosition.First) ' The alternative is to iterate the tabs (backwards ' since moving the tab to a different group will ' remove it from the tabs collection of the containing ' group) Dim j As Integer For j = tabGroup.Tabs.Count - 1 To 0 Step - 1 Dim tab As MdiTab = tabGroup.Tabs(j) ' (2) The Reposition method will take a tab object ' and move the invoking tab to the same tab group ' as the specified tab and positioned relative to that tab ' 'tab.Reposition(firstGroup.SelectedTab, MdiTabPosition.Last) ' (3) Calling the MoveToGroup without specifying an index ' will move the tab to the specified group and position ' it at the end. This is equivalent to calling: 'tab.MoveToGroup(firstGroup, firstGroup.Tabs.Count) tab.MoveToGroup(firstGroup) Next Next ' reset the previously selected tab firstGroup.SelectedTab = selectedTab ' reinitialize the tab was previously the first displayed tab firstGroup.FirstDisplayedTab = firstDisplayedTab Me.ultraTabbedMdiManager1.EndUpdate() End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinTabs; using Infragistics.Win.UltraWinTabbedMdi; private void MoveAllToFirstGroup() { // There are multiple ways to reposition a group. Which you use // will depend upon what you are trying to accomplish although // there are usually several mechanisms for achieving the // desired result. Here we are moving all the tabs from all // the tab groups into the first tab group. Several numbered // but commented out ways are presented to complete the task. // // if there are no mdi tab groups, there is nothing to do if (!this.ultraTabbedMdiManager1.HasTabGroups) return; // get the first group MdiTabGroup firstGroup = this.ultraTabbedMdiManager1.TabGroups[0]; MdiTab firstDisplayedTab = firstGroup.FirstDisplayedTab; MdiTab selectedTab = firstGroup.SelectedTab; this.ultraTabbedMdiManager1.BeginUpdate(); // iterate through all the tab groups after // the first one and move the tabs to the first group. // we'll iterate backwards since removing all the tabs // in a group causes the group to get removed // int count = this.ultraTabbedMdiManager1.TabGroups.Count - 1; for(int i = count; i > 0 ; i--) { MdiTabGroup tabGroup = this.ultraTabbedMdiManager1.TabGroups[i]; // (1) The MoveAllTabs method is convenient to move all // the contained tabs to an existing tabgroup. the // MdiTabGroupPosition parameter is used to determine // the tab group which tab group, relative to the // calling tab group's current position tabGroup.MoveAllTabs(MdiTabGroupPosition.First); // The alternative is to iterate the tabs (backwards // since moving the tab to a different group will // remove it from the tabs collection of the containing // group) for(int j = tabGroup.Tabs.Count - 1; j >= 0; j--) { MdiTab tab = tabGroup.Tabs[j]; // (2) The Reposition method will take a tab object // and move the invoking tab to the same tab group // as the specified tab and positioned relative to that tab // tab.Reposition(firstGroup.SelectedTab, MdiTabPosition.Last); // (3) Calling the MoveToGroup without specifying an index // will move the tab to the specified group and position // it at the end. This is equivalent to calling: tab.MoveToGroup(firstGroup, firstGroup.Tabs.Count); tab.MoveToGroup(firstGroup); } } // reset the previously selected tab firstGroup.SelectedTab = selectedTab; // reinitialize the tab was previously the first displayed tab firstGroup.FirstDisplayedTab = firstDisplayedTab; this.ultraTabbedMdiManager1.EndUpdate(); }