InkCanvasSelectionHitResult InkCanvasSelectionHitResult InkCanvasSelectionHitResult InkCanvasSelectionHitResult Enum

定義

InkCanvas の選択装飾のさまざまな部分を識別します。Identifies the various parts of a selection adorner on an InkCanvas.

public enum class InkCanvasSelectionHitResult
public enum InkCanvasSelectionHitResult
type InkCanvasSelectionHitResult = 
Public Enum InkCanvasSelectionHitResult
継承
InkCanvasSelectionHitResultInkCanvasSelectionHitResultInkCanvasSelectionHitResultInkCanvasSelectionHitResult

フィールド

Bottom Bottom Bottom Bottom 6

選択装飾の中央下ハンドル。The lower middle handle of the selection adorner.

BottomLeft BottomLeft BottomLeft BottomLeft 7

選択装飾の左下ハンドル。The lower left handle of the selection adorner.

BottomRight BottomRight BottomRight BottomRight 5

選択装飾の右下ハンドル。The lower right handle of the selection adorner.

Left Left Left Left 8

選択装飾の左端にある中央ハンドル。The middle handle on the left edge of the selection adorner.

None None None None 0

選択装飾のどこの部分も含まれません。No part of the selection adorner.

Right Right Right Right 4

選択装飾の右端にある中央ハンドル。The middle handle on the right edge of the selection adorner.

Selection Selection Selection Selection 9

選択装飾の境界内の領域。The area within the bounds of the selection adorner.

Top Top Top Top 2

選択装飾の中央上ハンドル。The upper middle handle of the selection adorner.

TopLeft TopLeft TopLeft TopLeft 1

選択装飾の左上ハンドル。The upper left handle of the selection adorner.

TopRight TopRight TopRight TopRight 3

選択装飾の右上ハンドル。The upper right handle of the selection adorner.

次の例は、 HitTestSelection DataObjectを使用してドラッグアンドドロップを開始するかどうかを判断する方法を示しています。The following example demonstrates how use HitTestSelection to determine whether to create a DataObject to initiate drag and drop. 2つInkCanvasのオブジェクト間でドラッグアンドドロップを実装するには、「方法:インクをドラッグアンドドロップします。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

注釈

メソッドHitTestSelectionは、選択InkCanvasSelectionHitResult装飾のどの部分がとPoint交差しているかを示すを返します。The HitTestSelection method returns an InkCanvasSelectionHitResult to indicate which part of the selection adorner intersects or surrounds a Point. これは、ドラッグアンドドロップ操作を実行する場合に便利です。This is useful when performing drag-and-drop operations.

XAML テキストの使用XAML Text Usage

このクラスは、通常、XAML では使用されません。This class is not typically used in XAML.

適用対象