出错:过程声明与同名事件或过程的描述不匹配
为什么?

解决方案 »

  1.   

    Private Sub UserControl_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
      

  2.   

    因为我要用的是控件数组,那怎么才能传进index值呢?
      

  3.   

    新建一个用户控件,控件里边包含以下程序:
    Option Explicit
    Dim L As Boolean
    #If L Then
        Public Event MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    #Else
        Public Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)Private Sub UserControl_AmbientChanged(PropertyName As String)
        On Error GoTo MyError
        L = False
        If UserControl.Extender.Index > 0 Then L = True
    MyError:
    End Sub#End If
    Private Sub UserControl_Initialize()
        On Error GoTo MyError
        L = False
        If UserControl.Extender.Index > 0 Then L = True
    MyError:
    End SubPrivate Sub UserControl_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
        On Error Resume Next
        If L Then
            RaiseEvent MouseUp(UserControl.Extender.Index, Button, Shift, X, Y)
        Else
            RaiseEvent MouseUp(Button, Shift, X, Y)
        End If
    End Sub
      

  4.   

    错了,应该是这样:
    Option Explicit
    Dim L As Boolean
    #If L Then
        Public Event MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    #Else
        Public Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    #End If
    Private Sub UserControl_AmbientChanged(PropertyName As String)
        On Error GoTo MyError
        L = False
        If UserControl.Extender.Index > 0 Then L = True
    MyError:
    End Sub
    Private Sub UserControl_Initialize()
        On Error GoTo MyError
        L = False
        If UserControl.Extender.Index > 0 Then L = True
    MyError:
    End SubPrivate Sub UserControl_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
        On Error Resume Next
        If L Then
            RaiseEvent MouseUp(UserControl.Extender.Index, Button, Shift, X, Y)
        Else
            RaiseEvent MouseUp(Button, Shift, X, Y)
        End If
    End Sub
      

  5.   

    还错,应该是这样:
    Option Explicit
    Dim L As Boolean
    #If L Then
        Public Event MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    #Else
        Public Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    #End If
    Private Sub UserControl_AmbientChanged(PropertyName As String)
        On Error GoTo MyError
        L = False
        If UserControl.Extender.Index >= 0 Then L = True
    MyError:
    End Sub
    Private Sub UserControl_Initialize()
        On Error GoTo MyError
        L = False
        If UserControl.Extender.Index >= 0 Then L = True
    MyError:
    End SubPrivate Sub UserControl_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
        On Error Resume Next
        If L Then
            RaiseEvent MouseUp(UserControl.Extender.Index, Button, Shift, X, Y)
        Else
            RaiseEvent MouseUp(Button, Shift, X, Y)
        End If
    End Sub
      

  6.   

    试过了,出错:byref参数类型不附。
    为什么?