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 control for use with a Canvas)
I've got the following code:
The IDE gives me the error: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
"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?![]()


Reply With Quote


