'宣言 Public Property AllowClose As Infragistics.Win.DefaultableBoolean
public Infragistics.Win.DefaultableBoolean AllowClose {get; set;}
MdiTab は、UltraTabbedMdiManager のユーザー インターフェイスを使用して 2 通りの方法で閉じることができます。1 つめは閉じるボタン (MdiTabGroup に「X」として表示される) を使用する方法で、もう 1 つはタブを右クリックしたときに表示されるコンテキスト メニューを使用する方法です。MdiTabGroup に表示される閉じるボタンは MdiTabGroupSettings.ShowCloseButton を False に設定することで非表示にできますが、それでもコンテキスト メニューのオプションは使用可能です。AllowClose が False に解決される場合(デフォルト値は True)、コンテキスト メニューのオプションは表示されず、閉じるボタン(表示されている場合)はタブが選択タブのときに無効になります。AllowClose の設定にかかわらず、MdiTab.Close メソッドを使用してタブを閉じることができます。
Imports Infragistics.Win Imports Infragistics.Win.UltraWinTabs Imports Infragistics.Win.UltraWinTabbedMdi Private Sub InitializeTabbedMdi(ByVal mdiManager As UltraTabbedMdiManager) ' the same type (MdiTabSettings) is used for the ' TabSettings of the UltraTabbedMdiManager - affects all tabs ' TabSettings of the MdiTabGroup - affects all tabs in group ' Settings of the MdiTab - affects the specific tab Me.InitializeTabSettings(mdiManager.TabSettings) ' the same type (MdiTabGroupSettings) is used for the ' TabGroupSettings of the UltraTabbedMdiManager - affects all tab groups ' Settings of the MdiTabGroup - affects the specific tab group Me.InitializeTabGroupSettings(mdiManager.TabGroupSettings) End Sub Private Sub InitializeTabSettings(ByVal tabSettings As MdiTabSettings) ' allow tabs contained in the tab group to being closed tabSettings.AllowClose = DefaultableBoolean.True ' close the associated form when the close ' button is pressed tabSettings.TabCloseAction = MdiTabCloseAction.Close ' only allow tabs to be repositioned within its containing group tabSettings.AllowDrag = MdiTabDragStyle.WithinGroup ' do not use the icon of the associated for as ' the image for the tab tabSettings.DisplayFormIcon = DefaultableBoolean.False ' enable hot tracking - the tab will make use ' of the hot track appearance when the mouse is ' over the tab tabSettings.HotTrack = DefaultableBoolean.True ' when the mouse is over the tab, the forecolor ' should use the system's hot track color tabSettings.HotTrackTabAppearance.ForeColor = SystemColors.HotTrack ' when the tab is selected, use the system colors button ' colors tabSettings.SelectedTabAppearance.BackColor = SystemColors.ControlDarkDark tabSettings.SelectedTabAppearance.ForeColor = SystemColors.ControlLightLight End Sub Private Sub InitializeTabGroupSettings(ByVal groupSettings As MdiTabGroupSettings) ' display the close button in the tab group groupSettings.ShowCloseButton = DefaultableBoolean.True ' enable the automatic selection of a tab when the mouse ' is over a tab for a specific period of time groupSettings.AutoSelect = DefaultableBoolean.True ' wait 2 seconds when the mouse enters ' the bounds of the tab before it is selected automatically groupSettings.AutoSelectDelay = 0 ' do not allow a tab's width to exceed 200 pixels groupSettings.MaxTabWidth = 200 ' do not allow a tab's width to be less than 50 pixels groupSettings.MinTabWidth = 50 ' put 2 pixels of padding around the image and text area groupSettings.TabPadding = New Size(2, 2) ' have the tabs aligned to the bottom of the tab group groupSettings.TabOrientation = TabOrientation.BottomLeft ' have the tab's size based on their image and text but ' they will be constrained to the limits set above groupSettings.TabSizing = TabSizing.AutoSize ' use worksheet style tabs groupSettings.TabStyle = TabStyle.Excel End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinTabs; using Infragistics.Win.UltraWinTabbedMdi; private void InitializeTabbedMdi(UltraTabbedMdiManager mdiManager) { // the same type (MdiTabSettings) is used for the // TabSettings of the UltraTabbedMdiManager - affects all tabs // TabSettings of the MdiTabGroup - affects all tabs in group // Settings of the MdiTab - affects the specific tab this.InitializeTabSettings(mdiManager.TabSettings); // the same type (MdiTabGroupSettings) is used for the // TabGroupSettings of the UltraTabbedMdiManager - affects all tab groups // Settings of the MdiTabGroup - affects the specific tab group this.InitializeTabGroupSettings(mdiManager.TabGroupSettings); } private void InitializeTabSettings( MdiTabSettings tabSettings ) { // allow tabs contained in the tab group to being closed tabSettings.AllowClose = DefaultableBoolean.True; // close the associated form when the close // button is pressed tabSettings.TabCloseAction = MdiTabCloseAction.Close; // only allow tabs to be repositioned within its containing group tabSettings.AllowDrag = MdiTabDragStyle.WithinGroup; // do not use the icon of the associated for as // the image for the tab tabSettings.DisplayFormIcon = DefaultableBoolean.False; // enable hot tracking - the tab will make use // of the hot track appearance when the mouse is // over the tab tabSettings.HotTrack = DefaultableBoolean.True; // when the mouse is over the tab, the forecolor // should use the system's hot track color tabSettings.HotTrackTabAppearance.ForeColor = SystemColors.HotTrack; // when the tab is selected, use the system colors button // colors tabSettings.SelectedTabAppearance.BackColor = SystemColors.ControlDarkDark; tabSettings.SelectedTabAppearance.ForeColor = SystemColors.ControlLightLight; } private void InitializeTabGroupSettings( MdiTabGroupSettings groupSettings ) { // display the close button in the tab group groupSettings.ShowCloseButton = DefaultableBoolean.True; // enable the automatic selection of a tab when the mouse // is over a tab for a specific period of time groupSettings.AutoSelect = DefaultableBoolean.True; // wait 2 seconds when the mouse enters // the bounds of the tab before it is selected automatically groupSettings.AutoSelectDelay = 0; // do not allow a tab's width to exceed 200 pixels groupSettings.MaxTabWidth = 200; // do not allow a tab's width to be less than 50 pixels groupSettings.MinTabWidth = 50; // put 2 pixels of padding around the image and text area groupSettings.TabPadding = new Size(2,2); // have the tabs aligned to the bottom of the tab group groupSettings.TabOrientation = TabOrientation.BottomLeft; // have the tab's size based on their image and text but // they will be constrained to the limits set above groupSettings.TabSizing = TabSizing.AutoSize; // use worksheet style tabs groupSettings.TabStyle = TabStyle.Excel; }