vb.netclassbase-classraiseeventaxshockwaveflash

Raise Events Custom Control Class which Inherits Base Class


I'm trying to design a "pass-through" for the axShockwaveFlash control. This control does not have .MouseDown, .MouseUp or .MouseMove events associated with it. Sadly, I need to detect these events on any shockwave controls as they are used in another class (which detects these events on a variety of different controls).

So, I tried designing a custom class, modifying the axShockwaveFlash class to include these events. However, I get the following error:

"Derived classes cannot raise base class events."

on the line:

RaiseEvent MouseDown(Me, EventArgs.Empty)

Full code (minus the up and move functions):

Imports System.Runtime.InteropServices
Imports System.Threading

Public Class MousedFlash

    Inherits AxShockwaveFlashObjects.AxShockwaveFlash

    'WndProc Inputs:
    Private Const WM_RBUTTONDOWN As Integer = &H204
    Private Const WM_LBUTTONDOWN As Integer = &H201

    Protected Overloads Sub OnMouseDown()
        RaiseEvent MouseDown(Me, EventArgs.Empty)
    End Sub

    Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
        Select Case m.Msg
            Case WM_RBUTTONDOWN
                Debug.WriteLine("MOUSE FLASH - right down!")
                Call OnMouseDown()
                Return
            Case WM_LBUTTONDOWN
                Debug.WriteLine("MOUSE FLASH - left down!")
                Call OnMouseDown()
                Return
        End Select
        MyBase.WndProc(m)
    End Sub

End Class

I think the Base Class is AxShockwaveFlashObjects - but I can't see the mouse events defined in here. Bit out my depth on this one - any help appreciated.


Solution

  • Thanks. In the end a mixture of carelessness on my part and the wrong type of over-ride. Final working replacement:

    Shadows Event MouseDown As System.EventHandler
    Protected Overridable Sub OnMouseDownTrigger()
        RaiseEvent MouseDown(Me, EventArgs.Empty)
    End Sub