Share via


GeometryHitTestParameters(Geometry) Costruttore

Definizione

Inizializza una nuova istanza della classe GeometryHitTestParameters usando l'oggetto Geometry specificato.

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)

Parametri

geometry
Geometry

Valore Geometry da usare per l'hit test della geometria.

Esempio

Nell'esempio seguente viene illustrato come configurare un hit test usando GeometryHitTestParameters per il HitTest metodo . Un Point valore viene usato per creare un Geometry oggetto per espandere l'intervallo di hit test su un'area di visualizzazione più ampia.

// 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))

Si applica a

Vedi anche