Applies to: PowerForm Control
See also: MouseDownControl Event,
Event Index
The MouseUpControl event occurs when the subclassed window has captured mouse
input, and a mouse button is released whilst the mouse pointer is within a
control placed in the same container as the PowerForm control.
Syntax:
Private Sub object_MouseUpControl(ctl
As Object, ByVal Button
As MouseButtonConstants, ByVal Shift
As Boolean, ByVal Control
As Boolean, ByVal x As
Long, ByVal y As
Long)
The MouseDownControl event syntax has these parts:
Part |
Description |
object |
The name of a PowerForm control. |
ctl |
A reference to the control that the mouse pointer was over when the
button was pressed.
|
Button |
A value indicating which button was clicked. Can be any one of the
following values:
- vbLeftButton
- vbMiddleButton
- vbRightButton
|
Shift |
A boolean value indicating the state of the Shift key. A value of
True indicates that one or both Shift keys are down. |
Control |
A boolean value indicating the state of the Control key. A value
of True indicates that one or both Control keys are down |
x |
The x coordinate (in pixels) of the mouse pointer at the time it was
released, relative to the top-left corner of the window or control. |
y |
The y coordinate (in pixels) of the mouse pointer at the time it was
released, relative to the top-left corner of the window or control. |
Remarks:
The MouseUpControl event is only raised if the control was added to the form at
design time. Releasing a mouse button over a dynamically loaded control will not generate a
MouseUpControl event. The MouseUpChild event of the Subclasser object would be
better suited to that task.
The MouseUpControl event is only raised if the subclassed window has captured
mouse input.
To enable the MouseDownControl and MouseUpControl events, call TrackMouse in the
MouseEnter event.
By default, the PowerForm control will release mouse
capture when the mouse pointer leaves the subclassed window or enters a child
control.
In order to retain mouse input capture when the mouse pointer enters a child
window, cancel any MouseLeave events where Side = siChildWindow. This will disable normal processing of mouse messages by
child windows, and will allow the PowerForm control to handle messages that
would normally be processed by child windows.
Example:
'This example disables
normal handling of mouse events
'by controls on the form, and outputs a message whenever
'the user presses a mouse button over a control on the form.
Option Explicit
Private Sub PowerForm1_MouseEnter()
'Call TrackMouse to enable the MouseDownControl,
'and MouseLeave events.
PowerForm1.TrackMouse
End Sub
Private Sub PowerForm1_MouseDownControl(ctl As
Object, ByVal Button As MouseButtonConstants,
ByVal Shift As
Boolean, ByVal Control As
Boolean, ByVal x As
Long, ByVal y As
Long)
Debug.Print
"MouseDownControl " & ctl.Name
End Sub
Private Sub PowerForm1_MouseLeave(ByVal Side
As AkemiPowerPack.SideConstants, Cancel As
Boolean)
If Side = siChildWindow Then
'Cancel the MouseLeave event if the mouse pointer
'has entered a child
window. This will have the
'effect of retaining mouse
capture until the
'mouse pointer leaves the
SubClassed window
'all together.
Cancel = True
End If
End Sub
|
|