Skip to content

MouseDown Event

Description

Occurs when the user presses a mouse button.

Syntax

Public Event MouseDown( _
    ByVal [Button](#) As Integer, _
    ByVal [Shift](#) As Integer, _
    ByVal [x](#) As Long, _
    ByVal [y](#) As Long _
)

Parameters

  • Button: Returns an integer that identifies the button that was pressed to cause the event.
  • Shift: Returns an integer that corresponds to the state of the SHIFT, CTRL, and ALT keys when the button specified in the Button argument is pressed.
  • x: Returns a number that specifies the current x coordinate location of the mouse pointer.
  • y: Returns a number that specifies the current y coordinate location of the mouse pointer.

Remarks

Use a MouseDown or MouseUp event procedure to specify actions that will occur when a given mouse button is pressed or released. Unlike the Click and DblClick events, MouseDown and MouseUp events enable you to distinguish between the left, right, and middle mouse buttons.

Use HitTest to test the coordinates to see which element was clicked.

Example

Dim ContextNode As FlowGraphNode

Private Sub FlowGraph_MouseUp(Button As Integer, Shift As Integer, x As Long, y As Long)  
    On Error Resume Next  

    If (Button = vbRightButton) Then  
        Set ContextNode = FlowGraph.HitTest(x, y)  
        If (Not ContextNode Is Nothing) Then  
            PopupMenu mnuContextMenu  
        End If  
    End If  
End Sub

See Also


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.