none
bc30590 RRS feed

  • Question

  • i need help here is my code

    '-- every refresh draw the base of the knob first, then rotate the picture as needed.
            Private Sub rotate_image_tutorial_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
                e.Graphics.DrawImage(_bitmapBack, _pBack)
                e.Graphics.DrawImage(MyRotate(_bitmapKnob, _sAngle), _pknob.X, _pknob.Y)
            End Sub
    
            '--When the user clicks the mouse down snag the location.  Important to determining if the mouse moved far enough to click the knob over a notch.
            Private Sub rotate_image_tutorial_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
                _pointMouseDown = e.Location
            End Sub
    
            '-- When the user is moving their mouse determine if the distance moved is great enough for the sensitivity to rotate the knob left or right.
            Private Sub rotate_image_tutorial_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
                If _pointMouseDown <> Nothing AndAlso (Distance(e.Location, _pointMouseDown) > _lMouseSensitivity) Then
                    If e.X > _pointMouseDown.X Then
                        DoMove(True)
                        _pointMouseDown = e.Location
                    ElseIf e.X < _pointMouseDown.X AndAlso (Distance(_pointMouseDown, e.Location) > _lMouseSensitivity) Then
                        DoMove(False)
                        _pointMouseDown = e.Location
                    End If
                End If
            End Sub
    
            '-- When the user let's go clear the holder for the mouse location.
            Private Sub rotate_image_tutorial_MouseUp(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
                _pointMouseDown = Nothing
            End Sub
    
            '-- If the user uses the arrow keys or a/d keys move the knob in the appropriate direction.
            Private Sub rotate_image_tutorial_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
                If e.KeyCode = Keys.Right OrElse e.KeyCode = Keys.D Then
                    DoMove(True)
                ElseIf e.KeyCode = Keys.Left OrElse e.KeyCode = Keys.A Then
                    DoMove(False)
                End If
            End Sub

    i keep getting "event could not be found" on each of these events. what do i do?

    Tuesday, November 21, 2017 3:21 PM

All replies

  • Hi

    What is

    rotate_image_tutorial

    Is it a Control on a Form?

    If so, did you type in these event handlers or get the template from the event list in the Designer?

    It would appear that the names used are no found? Maybe a difference in the spelling of the control name compared to the event handler names? Did you copy these handlers from somewhere else?

    As a test, you could select the control in the Designer (if it is a control added via the designer), and use the event list from the designer to see if any of the handlers are listed against the appropriate event.  If not, perhaps try double click on one of them (say) the Paint event and see if an empty template appears in your code,or if the code opens at the handler already in your code.

    If, for example, a new empty template is produced then you could copy/past the code from the old handler to the new one - and then delete the old one. Repeat for each handler.


    Regards Les, Livingston, Scotland

    Tuesday, November 21, 2017 3:49 PM
  • Is this a custom control or user control?

    If so what is it inheriting from?

    What import statements are used?


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Tuesday, November 21, 2017 3:52 PM
    Moderator