参考这个项目:http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=30142&replyID=&skin=1
我想做的是把所有的要打开的窗口全部在窗口的【click】中定义,应该如何改呀?
【click】
Select Case e.sender.name
Case "订单"
Dim tabc As WinForm.TabControl
tabc= e.Form.Controls("TabControl1")
For a As Integer=0 To tabc.TabPages.Count-1
If tabc.TabPages(a).Text="订单" Then
tabc.SelectedIndex=a
Return
End If
Next
tabc.TabPages.Add("订单","订单")
tabc.SelectedIndex=tabc.TabPages.Count-1
tabc.SelectedPage.Image=GetImage("001.ico")
Forms("订单").open
Forms("订单").Visible=False
If Forms("订单").Opened Then
Dim panel As WinForm.Panel
panel= Forms("订单").Controls("Panel1")
tabc.TabPages("订单").AddControl(panel)
panel.Dock= Windows.Forms.DockStyle.fill
tabc.SelectedIndex=tabc.TabPages.Count-1
End If
Case "采购"
Dim tabc As WinForm.TabControl
tabc= e.Form.Controls("TabControl1")
For a As Integer=0 To tabc.TabPages.Count-1
If tabc.TabPages(a).Text="采购" Then
tabc.SelectedIndex=a
Return
End If
Next
tabc.TabPages.Add("采购","采购")
tabc.SelectedIndex=tabc.TabPages.Count-1
tabc.SelectedPage.Image=GetImage("001.ico")
Forms("采购").open
Forms("采购").Visible=False
If Forms("采购").Opened Then
Dim panel As WinForm.Panel
panel= Forms("采购").Controls("Panel1")
tabc.TabPages("采购").AddControl(panel)
panel.Dock= Windows.Forms.DockStyle.fill
tabc.SelectedIndex=tabc.TabPages.Count-1
End If
End Select
【Doubleclick】
Dim tabc As WinForm.TabControl
tabc=e.Form.Controls("TabControl1")
Dim str As String
str=tabc.SelectedPage.Text
If tabc.SelectedIndex<>0 Then
If Forms(str).Opened=True
Forms(str).Close
End If
tabc.TabPages.Delete(str)
End If