HitTestResult HitTestResult HitTestResult HitTestResult Class

定義

ヒット テストの戻り値を表すいくつかの派生クラスの基底クラスを提供します。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
継承
HitTestResultHitTestResultHitTestResultHitTestResult
派生

次の例は、取得する方法を示します、HitTestResultから値を返す、HitTestメソッド。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

注釈

PointHitTestResultGeometryHitTestResult、およびRayHitTestResultクラスから派生HitTestResultします。The PointHitTestResult, GeometryHitTestResult, and RayHitTestResult classes derive from HitTestResult.

プロパティ

VisualHit VisualHit VisualHit VisualHit

ヒットしたビジュアル オブジェクトを取得します。Gets the visual object that was hit.

メソッド

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

指定したオブジェクトが、現在のオブジェクトと等しいかどうかを判断します。Determines whether the specified object is equal to the current object.

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

既定のハッシュ関数として機能します。Serves as the default hash function.

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

現在のインスタンスの Type を取得します。Gets the Type of the current instance.

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

現在の Object の簡易コピーを作成します。Creates a shallow copy of the current Object.

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

現在のオブジェクトを表す文字列を返します。Returns a string that represents the current object.

(Inherited from Object)

適用対象

こちらもご覧ください