'调用范例
rivate Sub Form_Load()
'窗体内所有事件,包括窗体本身
InitHub Me
'窗体内所有按钮
InitHub Me, acCommandButton, 2
'窗体本身
InitHub Me, acForm, 1
'选项卡Page1上所有的TextBox控件
InitHub Page1, acTextBox, 2
'选项卡Page1上所有的TextBox控件
InitHub Page1, acTextBox, 2
End Sub
Private Sub 参数1_Change()
ReCount
End Sub
Private Sub 参数2_Change()
ReCount
End Sub
......
Private Sub 参数10_Change()
ReCount
End Sub
Public Sub ReCount()
总和=参数1+参数2+......+参数10
End Sub
Form_Load()
InitHub Page0, acTextBox, 2, "OnChange"
End Sub
Public Function OnEvent(ByVal strParents As String, ByVal strObject As String, ByVal strEvent As String)
If strObject Like "参数" Then 总和=参数1+参数2+...+参数10
End Function
'调用范例
Private Sub Form_Load()
'窗体内所有事件,包括窗体本身
InitHub Me, 0
'窗体内所有按钮
InitHub Me, 0, acCommandButton, 2
'窗体本身
InitHub Me, 0, acForm, 1
'选项卡Page1上所有的TextBox控件
InitHub Page1, 0, acAllType, 2
'选项卡Page1上所有的TextBox控件的OnGotFocus事件,但是不接管窗体原有的事件定义
InitHub Page1, 0, acAllType, ehHookMeChildren, "OnGotFocus", False
End Sub
''''''''''''''''''''''''''''''''''''''''''''''
'用户自定义函数,入口参数:
'strParent:发生事件的对象的父对象,如:窗体1
'strObject:发生事件的对象名,如:Command0
'strEvent:发生的事件名,如:OnClick
'intPort:事件自定义端口号,由初始化程序设定
''''''''''''''''''''''''''''''''''''''''''''''
Public Function OnEvent(ByVal intPort As Byte, ByVal strParents As String, ByVal strObject As String, ByVal strEvent As String)
'本函数为用户自定义函数
Debug.Print intPort & ": "; strParents & IIf(strParents = "", "", ".") & strObject & "_" & strEvent
End Function
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) | Powered by Discuz! X3.3 |