Hamish
Feb 9th, 2009, 08:16 AM
I'm creating a "ColorMap Canvas", i.e. a canvas where clicking the Canvas will return the color of the corresponding picture. (I'm actually adapting Atheist's PictureBox_ColorMap (http://www.vbforums.com/showthread.php?t=463553&highlight=picturebox_colormap) control for use with a Canvas)
I've got the following code:
Protected Overrides Sub OnMouseMove(ByVal e As MouseButtonEventArgs)
Dim p As System.Windows.Point = e.GetPosition(Me)
MyBase.OnMouseMove(e)
If _RaiseEventOnMouseMove Then
If Not _ColorMap Is Nothing AndAlso p.X <= _ColorMap.Width AndAlso p.Y <= _ColorMap.Height Then
RaiseEvent ColorMapMouseMove(Me, _ColorMap.GetPixel(CInt(p.X), CInt(p.Y)))
Else
RaiseEvent ColorMapMouseMove(Me, Nothing)
End If
End If
End Sub
The IDE gives me the error:
"sub 'OnMouseMove' cannot be declared 'Overrides' because it does not override a sub in a base class."
When I remove the keyword "Overrides" I get the error:
"sub 'OnMouseMove' shadows an overridable method in the base class 'UIElement'. To override the base method, this method must be declared 'Overrides'."
What's going on here? Why can't I override OnMouseMove? Is my IDE suffering from schizophrenia? :confused:
I've got the following code:
Protected Overrides Sub OnMouseMove(ByVal e As MouseButtonEventArgs)
Dim p As System.Windows.Point = e.GetPosition(Me)
MyBase.OnMouseMove(e)
If _RaiseEventOnMouseMove Then
If Not _ColorMap Is Nothing AndAlso p.X <= _ColorMap.Width AndAlso p.Y <= _ColorMap.Height Then
RaiseEvent ColorMapMouseMove(Me, _ColorMap.GetPixel(CInt(p.X), CInt(p.Y)))
Else
RaiseEvent ColorMapMouseMove(Me, Nothing)
End If
End If
End Sub
The IDE gives me the error:
"sub 'OnMouseMove' cannot be declared 'Overrides' because it does not override a sub in a base class."
When I remove the keyword "Overrides" I get the error:
"sub 'OnMouseMove' shadows an overridable method in the base class 'UIElement'. To override the base method, this method must be declared 'Overrides'."
What's going on here? Why can't I override OnMouseMove? Is my IDE suffering from schizophrenia? :confused: