InkCanvasSelectionHitResult InkCanvasSelectionHitResult InkCanvasSelectionHitResult InkCanvasSelectionHitResult Enum

Definición

Identifica las distintas partes del adorno de una selección en un control InkCanvas.Identifies the various parts of a selection adorner on an InkCanvas.

public enum class InkCanvasSelectionHitResult
public enum InkCanvasSelectionHitResult
type InkCanvasSelectionHitResult = 
Public Enum InkCanvasSelectionHitResult
Herencia
InkCanvasSelectionHitResultInkCanvasSelectionHitResultInkCanvasSelectionHitResultInkCanvasSelectionHitResult

Campos

Bottom Bottom Bottom Bottom 6

Controlador central inferior del adorno de la selección.The lower middle handle of the selection adorner.

BottomLeft BottomLeft BottomLeft BottomLeft 7

Controlador izquierdo inferior del adorno de la selección.The lower left handle of the selection adorner.

BottomRight BottomRight BottomRight BottomRight 5

Controlador derecho inferior del adorno de la selección.The lower right handle of the selection adorner.

Left Left Left Left 8

Controlador central del borde izquierdo del adorno de la selección.The middle handle on the left edge of the selection adorner.

None None None None 0

Ninguna parte del adorno de la selección.No part of the selection adorner.

Right Right Right Right 4

Controlador central del borde derecho del adorno de la selección.The middle handle on the right edge of the selection adorner.

Selection Selection Selection Selection 9

Área situada dentro de los límites del adorno de la selección.The area within the bounds of the selection adorner.

Top Top Top Top 2

Controlador central superior del adorno de la selección.The upper middle handle of the selection adorner.

TopLeft TopLeft TopLeft TopLeft 1

Controlador izquierdo superior del adorno de la selección.The upper left handle of the selection adorner.

TopRight TopRight TopRight TopRight 3

Controlador derecho superior del adorno de la selección.The upper right handle of the selection adorner.

Ejemplos

En el ejemplo siguiente se muestra cómo usar HitTestSelection para determinar si se debe crear un DataObject iniciar arrastrar y colocar.The following example demonstrates how use HitTestSelection to determine whether to create a DataObject to initiate drag and drop. Para implementar arrastrar y colocar entre dos InkCanvas objetos, vea Cómo: Arrastrar y colocar la entrada manuscrita.To implement drag and drop between two InkCanvas objects, see How to: Drag and Drop Ink.

void InkCanvas_PreviewMouseDown(object sender, MouseEventArgs e)
{
    InkCanvas ic = (InkCanvas)sender;
    
    Point pt = e.GetPosition(ic);

    // If the user is moving selected strokes, prepare the strokes to be
    // moved to another InkCanvas.
    if (ic.HitTestSelection(pt) == 
        InkCanvasSelectionHitResult.Selection)
    {
        StrokeCollection selectedStrokes = ic.GetSelectedStrokes();
        StrokeCollection strokesToMove = selectedStrokes.Clone();
    
        // Remove the offset of the selected strokes so they
        // are positioned when the strokes are dropped.
        Rect inkBounds = strokesToMove.GetBounds();
        TranslateStrokes(strokesToMove, -inkBounds.X, -inkBounds.Y);
        
        // Perform drag and drop.
        MemoryStream ms = new MemoryStream();
        strokesToMove.Save(ms);
        DataObject dataObject = new DataObject(
            StrokeCollection.InkSerializedFormat, ms);
        
        DragDropEffects effects = 
            DragDrop.DoDragDrop(ic, dataObject, 
                                DragDropEffects.Move);

        if ((effects & DragDropEffects.Move) == 
             DragDropEffects.Move)
        {
            // Remove the selected strokes 
            // from the current InkCanvas.
            ic.Strokes.Remove(selectedStrokes);
        }
    }
}
Private Sub InkCanvas_PreviewMouseDown(ByVal sender As Object, _
                               ByVal e As MouseButtonEventArgs)

    Dim ic As InkCanvas = CType(sender, InkCanvas)

    Dim pt As Point = e.GetPosition(ic)

    ' If the user is moving selected strokes, prepare the strokes to be
    ' moved to another InkCanvas.
    If ic.HitTestSelection(pt) = InkCanvasSelectionHitResult.Selection Then

        Dim selectedStrokes As StrokeCollection = _
                               ic.GetSelectedStrokes()

        Dim strokesToMove As StrokeCollection = _
                             selectedStrokes.Clone()

        ' Remove the offset of the selected strokes so they
        ' are positioned when the strokes are dropped.
        Dim inkBounds As Rect = strokesToMove.GetBounds()
        TranslateStrokes(strokesToMove, -inkBounds.X, -inkBounds.Y)

        ' Perform drag and drop.
        Dim ms As New MemoryStream()
        strokesToMove.Save(ms)

        Dim dataObject As New DataObject _
            (StrokeCollection.InkSerializedFormat, ms)

        Dim effects As DragDropEffects = _
            DragDrop.DoDragDrop(ic, dataObject, DragDropEffects.Move)

        If (effects And DragDropEffects.Move) = DragDropEffects.Move Then

            ' Remove the selected strokes from the current InkCanvas.
            ic.Strokes.Remove(selectedStrokes)
        End If
    End If

End Sub 'OnMouseDown

Comentarios

El HitTestSelection método devuelve un InkCanvasSelectionHitResult para indicar qué parte de la selección cruza o rodea de adorno una Point.The HitTestSelection method returns an InkCanvasSelectionHitResult to indicate which part of the selection adorner intersects or surrounds a Point. Esto resulta útil al realizar operaciones de arrastrar y colocar.This is useful when performing drag-and-drop operations.

Uso de texto XAMLXAML Text Usage

Esta clase no se usa normalmente en XAML.This class is not typically used in XAML.

Se aplica a