Compartir a través de


Ink.HitTest (Método) (Rectangle, Single)

Actualización: noviembre 2007

Devuelve la colección Strokes contenida en un objeto Rectangle conocido.

Espacio de nombres:  Microsoft.Ink
Ensamblado:  Microsoft.Ink (en Microsoft.Ink.dll)

Sintaxis

'Declaración
Public Function HitTest ( _
    selectionRectangle As Rectangle, _
    percentIntersect As Single _
) As Strokes
'Uso
Dim instance As Ink
Dim selectionRectangle As Rectangle
Dim percentIntersect As Single
Dim returnValue As Strokes

returnValue = instance.HitTest(selectionRectangle, _
    percentIntersect)
public Strokes HitTest(
    Rectangle selectionRectangle,
    float percentIntersect
)
public:
Strokes^ HitTest(
    Rectangle selectionRectangle, 
    float percentIntersect
)
public Strokes HitTest(
    Rectangle selectionRectangle,
    float percentIntersect
)
public function HitTest(
    selectionRectangle : Rectangle, 
    percentIntersect : float
) : Strokes

Parámetros

  • selectionRectangle
    Tipo: System.Drawing.Rectangle
    El rectángulo de selección, en coordenadas de espacio de entrada manuscrita.
  • percentIntersect
    Tipo: System.Single
    El valor de porcentaje que determina qué objetos Stroke se incluyen en la colección Strokes. Los objetos Stroke que forman intersección con el rectángulo se incluyen en la colección Strokes si el porcentaje de puntos en esos objetos Stroke contenidos en el rectángulo es mayor que o igual que el porcentaje pasado al parámetro percentIntersect.

Valor devuelto

Tipo: Microsoft.Ink.Strokes
La colección Strokes incluida en el área especificada.

Comentarios

Para determinar qué puntos de un objeto Stroke conocido forman una intersección con el área de la prueba de posicionamiento, llame al método Stroke.GetRectangleIntersections, que devuelve los puntos donde un objeto Stroke forma una intersección con un objeto Rectangle conocido.

Ejemplos

En este ejemplo, todos los objetos Stroke de InkOverlay que tengan al menos 75% de sus puntos dentro de un rectángulo tal y como está definido por las medidas 2000 x 2000 unidades HIMETRIC del lado superior izquierdo del control de la entrada manuscrita cambian a rojo. El rectángulo se hace visible usando los puntos de selección para crear un objeto Stroke.

Const RectSideInkUnits As Integer = 2000
' get the control. InkOverlay.AttachedControl must be set
Dim inkControl As Control = mInkOverlay.AttachedControl
' create the rectangle used for the hit test
Dim hitTestRect As Rectangle = New Rectangle(0, 0, RectSideInkUnits, RectSideInkUnits)
' create boundary points in order to show the rectangle by creating a stroke
Dim boundaryPts() As Point = _
    { _
        New Point(RectSideInkUnits, 0), _
        New Point(RectSideInkUnits, RectSideInkUnits), _
        New Point(0, RectSideInkUnits) _
    }

' show the rectangle by creating a stroke
mInkOverlay.Ink.CreateStroke(boundaryPts)
' Find strokes that fall at least 75% within the rectangle
Dim hitStrokes As Strokes = mInkOverlay.Ink.HitTest(hitTestRect, 75.0F)
' change the found strokes to red
hitStrokes.ModifyDrawingAttributes(New DrawingAttributes(Color.Red))
' invalidate the ink control
inkControl.Invalidate()
const int RectSideInkUnits = 2000;
// get the control. InkOverlay.AttachedControl must be set
Control inkControl = mInkOverlay.AttachedControl;
// create the rectangle used for the hit test
Rectangle hitTestRect = new Rectangle(0, 0, RectSideInkUnits, RectSideInkUnits);
// create boundary points in order to show the rectangle by creating a stroke
Point[] boundaryPts = new Point[3] 
    {
        new Point(RectSideInkUnits, 0),
        new Point(RectSideInkUnits, RectSideInkUnits),
        new Point(0, RectSideInkUnits)
    };

// show the rectangle by creating a stroke
mInkOverlay.Ink.CreateStroke(boundaryPts);
// Find strokes that fall at least 75% within the rectangle
Strokes hitStrokes = mInkOverlay.Ink.HitTest(hitTestRect, 75.0f);
// change the found strokes to red
hitStrokes.ModifyDrawingAttributes(new DrawingAttributes(Color.Red));
// invalidate the ink control
inkControl.Invalidate();

Plataformas

Windows Vista

.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

Información de versión

.NET Framework

Compatible con: 3.0

Vea también

Referencia

Ink (Clase)

Ink (Miembros)

HitTest (Sobrecarga)

Microsoft.Ink (Espacio de nombres)

Strokes

ExtendedProperties