WinTab, WinTabStrip, and WinTabbedMdiManager all include a close button which you can display on each tab. With the close button, your end user can close individual tabs without leaving the bounds of the tab itself – they can also click the tab with the middle mouse button to close it. By default, the close button is hidden, so if you want to expose the button to your end user, you’ll have to set the CloseButtonLocation property to Tab.
There are two related properties which play an important role in how each close button displays.
CloseButtonAlignment – The CloseButtonAlignment property determines on which side of the tabs the close button will appear. The TabCloseButtonAlignment property defaults to AfterContent; therefore, the close button displays after the text. Setting TabCloseButtonAlignment to BeforeContent places the close button before the tab’s text.
CloseButtonVisibility – The CloseButtonVisibility property determines in what situations the close button is visible to your end user. By default, TabCloseButtonVisibility resolves to Always, so every tab will include its own close button. However, if you only want the selected tab to have a close button, similar to Microsoft® Internet Explorer® 7, you will need to set CloseButtonVisibility to WhenSelected.
These two properties are not only exposed off the main control/component itself, but off of each individual tab. This convenient object model gives you the opportunity to individualize every tab according to your application’s logic.
The following example code demonstrates how to achieve the Internet Explorer 7 tabbed interface by enabling the close button on only the selected tab. Remember, this functionality is the same for WinTab, WinTabStrip, and WinTabbedMdiManager.
In Visual Basic:
Me.UltraTabControl1.CloseButtonLocation = _ Infragistics.Win.UltraWinTabs.TabCloseButtonLocation.Tab Me.UltraTabControl1.TabCloseButtonVisibility = _ Infragistics.Win.UltraWinTabs.TabCloseButtonVisibility.WhenSelected
In C#:
this.ultraTabControl1.CloseButtonLocation = Infragistics.Win.UltraWinTabs.TabCloseButtonLocation.Tab; this.ultraTabControl1.TabCloseButtonVisibility = Infragistics.Win.UltraWinTabs.TabCloseButtonVisibility.WhenSelected;