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. MouseDown and MouseUp events enable you to distinguish between the left, right, and middle mouse buttons.
Example
Private Sub RecentFileListBox_MouseUp(Button As Integer, Shift As Integer, x As Long, y As Long)
If (Button = vbRightButton) Then
Dim Item As CommandBarGalleryItem
Set Item = RecentFileListBox.HitTest(x, y)
If Not Item Is Nothing Then
Debug.Print Item.Caption
End If
End If
End Sub
See Also

Command Bars ActiveX Control v24.0
Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.