Condividi tramite


RayHitTestParameters.Origin Proprietà

Definizione

Ottiene l’origine del raggio lungo il quale viene eseguito un hit test.

public:
 property System::Windows::Media::Media3D::Point3D Origin { System::Windows::Media::Media3D::Point3D get(); };
public System.Windows.Media.Media3D.Point3D Origin { get; }
member this.Origin : System.Windows.Media.Media3D.Point3D
Public ReadOnly Property Origin As Point3D

Valore della proprietà

Origine del raggio lungo il quale viene eseguito un hit test.

Esempio

public void HitTest(object sender, System.Windows.Input.MouseButtonEventArgs args)
{
    Point mouseposition = args.GetPosition(myViewport);
    Point3D testpoint3D = new Point3D(mouseposition.X, mouseposition.Y, 0);
    Vector3D testdirection = new Vector3D(mouseposition.X, mouseposition.Y, 10);
    PointHitTestParameters pointparams = new PointHitTestParameters(mouseposition);
    RayHitTestParameters rayparams = new RayHitTestParameters(testpoint3D, testdirection);

    //test for a result in the Viewport3D
    VisualTreeHelper.HitTest(myViewport, null, HTResult, pointparams);
Public Sub HitTest(ByVal sender As Object, ByVal args As MouseButtonEventArgs)
    Dim mouseposition As Point = args.GetPosition(myViewport)
    Dim testpoint3D As New Point3D(mouseposition.X, mouseposition.Y, 0)
    Dim testdirection As New Vector3D(mouseposition.X, mouseposition.Y, 10)
    Dim pointparams As New PointHitTestParameters(mouseposition)
    Dim rayparams As New RayHitTestParameters(testpoint3D, testdirection)

    'test for a result in the Viewport3D
    VisualTreeHelper.HitTest(myViewport, Nothing, AddressOf HTResult, pointparams)

Commenti

Si noti che il livello visivo supporta il test di hit test su tutti gli oggetti in un punto o geometria, non solo l'oggetto superiore. Un hit test 2D restituirà anche risultati 3D direttamente sotto il punto o la geometria specificati.

Si applica a

Vedi anche