'宣言 Public Delegate Sub MdiTabMovingEventHandler( _ ByVal sender As Object, _ ByVal e As MdiTabMovingEventArgs _ )
public delegate void MdiTabMovingEventHandler( object sender, MdiTabMovingEventArgs e )
Imports Infragistics.Win Imports Infragistics.Win.UltraWinTabs Imports Infragistics.Win.UltraWinTabbedMdi Private Sub ultraTabbedMdiManager1_TabMoving(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTabbedMdi.MdiTabMovingEventArgs) Handles ultraTabbedMdiManager1.TabMoving ' The 'TabMoving' event is invoked when a tab is about ' to be repositioned. It may be repositioned within a ' group or moved to another group. ' The 'Cancel' parameter may be set to true to ' prevent the move operation from occuring. ' 'e.Cancel = True Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder() sb.AppendFormat("TabMoving: Tab ['{0}'] ", e.Tab) ' The 'Tab' parameter returns the MdiTab object that is ' about to be repositioned. The 'TabGroup' parameter returns ' the TabGroup that will contain the tab. The 'TabIndex' ' parameter returns the index at which the tab will be ' positioned. If e.Tab.TabGroup Is e.TabGroup Then ' it is being repositioned within its containing group Dim index As Integer = e.Tab.TabGroup.Tabs.IndexOf(e.Tab) sb.AppendFormat("is being moved within its group from index {0} to {1}.", index, e.TabIndex) ElseIf e.TabGroup.Tabs.Count = 0 Then ' it is being repositioned to a new group sb.Append("is being moved to a new MdiTabGroup. ") sb.AppendFormat("The new group is located at index: {0}.", e.TabGroup.Manager.TabGroups.IndexOf(e.TabGroup)) Else ' it is being repositioned in a different group sb.Append("is being moved to an existing tab group. ") sb.AppendFormat("The tab will be positioned at index {0}", e.TabIndex) End If System.Diagnostics.Debug.WriteLine(sb.ToString()) End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinTabs; using Infragistics.Win.UltraWinTabbedMdi; private void ultraTabbedMdiManager1_TabMoving(object sender, Infragistics.Win.UltraWinTabbedMdi.MdiTabMovingEventArgs e) { // The 'TabMoving' event is invoked when a tab is about // to be repositioned. It may be repositioned within a // group or moved to another group. // The 'Cancel' parameter may be set to true to // prevent the move operation from occuring. // //e.Cancel = true; System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.AppendFormat("TabMoving: Tab ['{0}'] ", e.Tab); // The 'Tab' parameter returns the MdiTab object that is // about to be repositioned. The 'TabGroup' parameter returns // the TabGroup that will contain the tab. The 'TabIndex' // parameter returns the index at which the tab will be // positioned. if (e.Tab.TabGroup == e.TabGroup) { // it is being repositioned within its containing group int index = e.Tab.TabGroup.Tabs.IndexOf(e.Tab); sb.AppendFormat("is being moved within its group from index {0} to {1}.", index, e.TabIndex); } else if (e.TabGroup.Tabs.Count == 0) { // it is being repositioned to a new group sb.Append("is being moved to a new MdiTabGroup. "); sb.AppendFormat("The new group is located at index: {0}.", e.TabGroup.Manager.TabGroups.IndexOf(e.TabGroup)); } else { // it is being repositioned in a different group sb.Append("is being moved to an existing tab group. "); sb.AppendFormat("The tab will be positioned at index {0}", e.TabIndex); } System.Diagnostics.Debug.WriteLine( sb.ToString() ); }