以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  新版本窗口内存  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=140286)

--  作者:kaituozhe
--  发布时间:2019/9/2 19:46:00
--  新版本窗口内存

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

 


--  作者:有点蓝
--  发布时间:2019/9/2 20:26:00
--  
Case "Exit"
        If vars("父tab") IsNot Nothing Then
            Dim tbl As WinForm.TabControl = vars("父tab")
            tbl.TabPages.Delete(tbl.SelectedPage.Name)
        End If
        Forms("合同情况汇总").Close