Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
HitBehavior Property
See Also Example Applies To
Returns or sets a value that defines the hit testing behavior of the HitTest event on a Windowless UserControl object.
Syntax
object.HitBehavior [= number]
The HitBehavior property syntax has these parts:
Part | Description |
object | A UserControl object. |
number | An integer that specifies hit testing behavior, as described in Settings. |
Settings
The settings for number are:
Constant | Setting | Description |
None | 0 | The HitTest event will always return a HitResult of 0 (vbHitResultOutside). |
UseRegion | 1 | (Default) The HitTest event will return a HitResult of 3 (vbHitResultHit) when the cursor is over the MaskRegion of your control. |
UsePaint | 2 | The HitTest event will return a HitResult of 3 (vbHitResultHit) when the cursor is over any painted area of the control. |
Remarks
You can use the HitBehavior property to determine where hits will occur on your UserControl. By default, only the MaskRegion of the control will return a hit in the HitTest event. The MaskRegion consists of any subcontrols plus any mask defined by the MaskPicture and MaskColor properties. Any areas outside of the MaskRegion will return a HitResult of 0.
By setting HitBehavior to None, the HitTest event will never return a hit. When the HitBehavior is set to UsePaint, the mask region plus the areas painted by graphics methods will return a hit.
When used in combination with the ClipBehavior property, this property helps to determine the HitResult argument of the HitTest event.
Note This property is ignored if the Windowless property of the UserControl object is set to False or if the BackStyle property is set to Opaque.
Important Not all control containers support the Windowless property. The HitBehavior property should only be changed if you know it will be used in containers that support Windowless activation.