If e.Node.Level = 1 OrElse e.Node.Level = 2 Then
Dim tab As WinForm.TabControl = e.Form.Controls("TabControl1")
If tab.TabPages(e.Node.Text) IsNot Nothing Then
tab.SelectedPage = tab.TabPages(e.Node.Text)
Else
Dim Name As String = e.Node.Text
tab.TabPages.Add(name,name)
Dim pb = tab.BaseControl
Forms(Name).OPEN(-1000,-1500)
Forms(Name).BaseForm.TopLevel = False
Forms(Name).BaseForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
Forms(Name).BaseForm.Dock = System.Windows.Forms.DockStyle.Fill
PB.TabPages(name).Controls.Clear
PB.TabPages(name).Controls.add(Forms(Name).BaseForm)
tab.SelectedPage = tab.TabPages(name)
vars("父tab") = tab
End If
End If
上面是打开窗口的代码,下面是关闭窗口的代码,使用此代码打开和关闭窗口后,内存还是没有释放,该修改?
Case "Exit"
Forms("合同情况汇总").StopRedraw
If vars("父tab") IsNot Nothing Then
Dim tbl As WinForm.TabControl = vars("父tab")
tbl.TabPages.Delete(tbl.SelectedPage.Name)
Else
Forms("合同情况汇总").Close
End If
Forms("合同情况汇总").ResumeRedraw