GeometryHitTestParameters(Geometry) Constructor
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the GeometryHitTestParameters class, using the specified Geometry.
public:
GeometryHitTestParameters(System::Windows::Media::Geometry ^ geometry);
public GeometryHitTestParameters (System.Windows.Media.Geometry geometry);
new System.Windows.Media.GeometryHitTestParameters : System.Windows.Media.Geometry -> System.Windows.Media.GeometryHitTestParameters
Public Sub New (geometry As Geometry)
Parameters
Examples
The following example shows how to set up a hit test by using GeometryHitTestParameters for the HitTest method. A Point value is used to create a Geometry object to expand the range of the hit test over a wider display area.
// Retrieve the coordinate of the mouse position.
Point pt = e.GetPosition((UIElement)sender);
// Expand the hit test area by creating a geometry centered on the hit test point.
EllipseGeometry expandedHitTestArea = new EllipseGeometry(pt, 10.0, 10.0);
// Set up a callback to receive the hit test result enumeration.
VisualTreeHelper.HitTest(myControl, null,
new HitTestResultCallback(MyHitTestResultCallback),
new GeometryHitTestParameters(expandedHitTestArea));
' Retrieve the coordinate of the mouse position.
Dim pt As Point = e.GetPosition(CType(sender, UIElement))
' Expand the hit test area by creating a geometry centered on the hit test point.
Dim expandedHitTestArea As New EllipseGeometry(pt, 10.0, 10.0)
' Set up a callback to receive the hit test result enumeration.
VisualTreeHelper.HitTest(myControl, Nothing, New HitTestResultCallback(AddressOf MyHitTestResultCallback), New GeometryHitTestParameters(expandedHitTestArea))
Applies to
See also
Colaborați cu noi pe GitHub
Sursa pentru acest conținut poate fi găsită pe GitHub, unde puteți, de asemenea, să creați și să consultați probleme și solicitări de tragere. Pentru mai multe informații, consultați ghidul nostru pentru colaboratori.