BUG: Phantom MouseMove Events with a Transparent UserControl (192003)
The information in this article applies to:
- Microsoft Visual Basic Learning Edition for Windows 5.0
- Microsoft Visual Basic Learning Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q192003 SYMPTOMS
A Visual Basic UserControl, whose BackStyle property is set to Transparent,
may erroneously receive MouseMove messages when the mouse is over the
control but is not currently moving.
CAUSE
The problem occurs because a property or method has been called on the
control that causes the control to repaint itself. The repaint event
results in a change in the window region for the control, which in turn
fires the MouseMove event.
This behavior does not occur if the UserControl's BackStyle property is set
to Opaque.
RESOLUTION
Setting the BackStyle property to Opaque offers one approach to working
around this problem. However, if this property must be set to Transparent,
another potential workaround is to use two static variables to monitor the
values of the X and Y coordinates sent to the MouseMove event. If these
values are the same as the previous MouseMove event, then you can treat
this mouse message as a phantom message.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 5/13/2003 |
---|
Keywords: | kbbug KB192003 |
---|
|