global.vb
来自「Programming the .NET Compact Framework w」· VB 代码 · 共 39 行
VB
39 行
Module Global
Friend arrForms As New ArrayList
Friend Function CreateForm(ByVal typeForm As Type) As Form
Dim frmWork As Form
Dim boolExists As Boolean = False
' Check to see if a form of the
' requested type already exists.
For Each frmWork In arrForms
If frmWork.GetType Is typeForm Then
boolExists = True
Exit For
End If
Next
' If is does not exist, create it
' and add it to the collection.
If Not boolExists Then
If typeForm Is GetType(FormTemperature) Then _
frmWork = New FormTemperature
If typeForm Is GetType(FormPressure) Then _
frmWork = New FormPressure
If typeForm Is GetType(FormPrecipitation) Then _
frmWork = New FormPrecipitation
arrForms.Add(frmWork)
End If
' In either case, the a reference to the form
' of the correct type is now in frmWork.
' Return it.
Return frmWork
End Function
Friend Sub RemoveForm(ByVal frmRemovee As Form)
arrForms.Remove(frmRemovee)
End Sub
End Module
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?