SOS!!!只要父窗体中有任何一个子窗体存在(Show出来了),当然也可以同时存在(Show出来了)多个!那么MDIForm内的Picture控件Visable=False,当所有的子窗体关闭时(Unload),MDIForm内的Picture控件Visable=True,只要还有一个子窗体存在(Show出来了),MDIForm内的Picture控件Visable还是False,如何办到????????
调试欢乐多
If Me.ActiveForm Is Nothing Then
Picture1.Enabled = True
Else
Picture1.Enabled = False
End If
End Sub
下面这个函数计算程序中子窗体的个数。
Private Function childFormCount() As Integer
Dim fm As Form
Dim count As Integer
count = 0
For Each fm In Forms
If fm.MDIChild = True Then
count = count + 1
End If
Next
childFormCount = count
End Function
在每次show或者unload一个子窗体后,调用这个函数,如果为0,说明没有子窗体,picture1.visible=true,若大于0,picture1.visible=false。
不知道可不可以,欢迎批评指正。
Public Function childFormCount() As Integer
Dim fm As Form
Dim count As Integer
count = 0
For Each fm In Forms
If Not fm Is MDIForm1 Then
If fm.MDIChild = True Then
count = count + 1
End If
End If
Next
childFormCount = count
End Function
就是在每一个子窗体的unload事件里做判断。