PointHitTestResult Classe

Definizione

Rappresenta i risultati di un hit test che usa come Point parametro di hit test.

public ref class PointHitTestResult : System::Windows::Media::HitTestResult
public class PointHitTestResult : System.Windows.Media.HitTestResult
type PointHitTestResult = class
    inherit HitTestResult
Public Class PointHitTestResult
Inherits HitTestResult
Ereditarietà
PointHitTestResult
Derivato

Esempio

Nell'esempio seguente viene illustrato come recuperare il PointHitTestResult valore restituito dal HitTest metodo .

// Respond to the left mouse button down event by initiating the hit test.
private void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
    // Retrieve the coordinate of the mouse position.
    Point pt = e.GetPosition((UIElement)sender);

    // Perform the hit test against a given portion of the visual object tree.
    HitTestResult result = VisualTreeHelper.HitTest(myCanvas, pt);

    if (result != null)
    {
        // Perform action on hit visual object.
    }
}
' Respond to the left mouse button down event by initiating the hit test.
Private Overloads Sub OnMouseLeftButtonDown(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
    ' Retrieve the coordinate of the mouse position.
    Dim pt As Point = e.GetPosition(CType(sender, UIElement))

    ' Perform the hit test against a given portion of the visual object tree.
    Dim result As HitTestResult = VisualTreeHelper.HitTest(myCanvas, pt)

    If result IsNot Nothing Then
        ' Perform action on hit visual object.
    End If
End Sub

Commenti

È anche possibile eseguire un hit test su un oggetto visivo usando un Geometry oggetto come parametro hit test e restituendo il risultato come .GeometryHitTestResult Per altre informazioni, vedere Procedura: Hit Test usando la geometria come parametro.

Costruttori

Nome Descrizione
PointHitTestResult(Visual, Point)

Inizializza una nuova istanza della classe PointHitTestResult.

Proprietà

Nome Descrizione
PointHit

Ottiene il valore del punto restituito da un risultato dell'hit test.

VisualHit

Ottiene l'oggetto visivo restituito da un risultato dell'hit test.

Metodi

Nome Descrizione
Equals(Object)

Determina se l'oggetto specificato è uguale all'oggetto corrente.

(Ereditato da Object)
GetHashCode()

Funge da funzione hash predefinita.

(Ereditato da Object)
GetType()

Ottiene il Type dell'istanza corrente.

(Ereditato da Object)
MemberwiseClone()

Crea una copia superficiale del Objectcorrente.

(Ereditato da Object)
ToString()

Restituisce una stringa che rappresenta l'oggetto corrente.

(Ereditato da Object)

Si applica a