SuperTabControl内嵌窗体Form_Load事件

场景:通常情况下,将窗体add进TabControl,但是关闭TabItem的时候,并没有触发内嵌窗体的关闭窗体事件,但有时候又希望触发该事件。

处理:为了方便,最好在add窗体的,TabItem的.Text设置与Form一样的Text

Private Sub NavSuperTabControl_TabItemClose(ByVal sender As Object, ByVal e As DevComponents.DotNetBar.SuperTabStripTabItemCloseEventArgs) Handles NavSuperTabControl.TabItemClose
        Dim tabitem As SuperTabItem
        For Each tabitem In NavSuperTabControl.Tabs
            If tabitem.Name = e.Tab.Tag Then
                NavSuperTabControl.SelectedTab = tabitem
                Exit For
            End If
        Next
        Dim frm As Form = Me.NavSuperTabControl.SelectedPanel.Controls.Find(e.Tab.Tag, False)(0)
        frm.Close()
    End Sub

你可能感兴趣的:(SuperTabControl内嵌窗体Form_Load事件)