HitTestResult HitTestResult HitTestResult HitTestResult Class

Definición

Proporciona la clase base de varias clases derivadas que representa el valor devuelto de una prueba de posicionamiento.Provides the base class for several derived classes that represents the return value from a hit test.

public ref class HitTestResult abstract
public abstract class HitTestResult
type HitTestResult = class
Public MustInherit Class HitTestResult
Herencia
HitTestResultHitTestResultHitTestResultHitTestResult
Derivado

Ejemplos

En el ejemplo siguiente se muestra cómo recuperar HitTestResult el valor devuelto HitTest desde el método.The following example shows how to retrieve the HitTestResult return value from the HitTest method.

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

Comentarios

Las PointHitTestResultclases GeometryHitTestResult, HitTestResulty RayHitTestResult se derivan de.The PointHitTestResult, GeometryHitTestResult, and RayHitTestResult classes derive from HitTestResult.

Propiedades

VisualHit VisualHit VisualHit VisualHit

Obtiene el objeto visual que se alcanzó.Gets the visual object that was hit.

Métodos

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determina si el objeto especificado es igual al objeto actual.Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Sirve como la función hash predeterminada.Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Obtiene el Type de la instancia actual.Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Crea una copia superficial del objeto Object actual.Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Devuelve una cadena que representa el objeto actual.Returns a string that represents the current object.

(Inherited from Object)

Se aplica a

Consulte también: