MouseDown Event
Description
Occurs when the mouse pointer is over the StatusBar control and a mouse button is pressed.
Syntax
Public Event MouseDown( _
ByVal [Button](#) As Integer, _
ByVal [Shift](#) As Integer, _
ByVal [x](#) As Long, _
ByVal [y](#) As Long _
)
Parameters
Button
Code indicating which button on the mouse was pressed. Below are the meanings of mouse button codes:
| Button Value | ||
|---|---|---|
| Left Mouse Button | 1 | |
| Right Mouse Button | 2 |
Shift
Specifies whether the Shift, Ctrl, or ALT keys were pressed when the mouse button is pressed. Any combination of the Shift, Alt, and Ctrl keys can be used. The table below shows the possible values for the Shift parameter:
| Shift Parameter Value | Bit Mask | |
|---|---|---|
| Shift | 001 | 1 |
| Ctrl | 010 | 2 |
| Shift + Ctrl | 011 | 3 |
| Alt | 100 | 4 |
| Alt + Shift | 101 | 5 |
| Alt + Ctrl | 110 | 6 |
| Shift + Alt + Ctrl | 111 | 7 |
x
X coordinate of the mouse pointer.
y
Y coordinate of the mouse pointer.
Remarks
The MouseDown and MouseUp events occur when the mouse pointer is pressed and released while over the StatusBar. The HitTest method can use the x and y parameters to determine if a pane was under the mouse pointer when it was pressed or released.
Example
StatusBar MouseDown Sample (Visual Basic)
This sample illustrates how to use the HitTest method in the MouseDown/MouseUp events to determine what status bar pane, if any, was clicked.
Private Sub StatusBar_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
If (Button = vbRightButton) Then
Dim Pane As StatusBarPane
Set Pane = StatusBar.HitTest(x, y)
If (Not Pane Is Nothing) Then
Debug.Print "StatusBar_MouseDown. Button = vbRightButton. Id = "; Pane.Id
End If
End If
End Sub
See Also
StatusBar Collection | HitTest Method
Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.