Dim tab As WinForm.TabControl = e.Form.Controls("TabControl1")
Dim Name As String = "窗口2"
For Each page As WinForm.TabPage In tab.TabPages
If page.Name = Name Then Return
Next
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) '切换到新添加的页签