InkCanvasSelectionHitResult Sabit listesi

Tanım

InkCanvasbir seçim donatıcısının çeşitli bölümlerini tanımlar.

public enum class InkCanvasSelectionHitResult
public enum InkCanvasSelectionHitResult
type InkCanvasSelectionHitResult = 
Public Enum InkCanvasSelectionHitResult
Devralma
InkCanvasSelectionHitResult

Alanlar

Name Değer Description
None 0

Seçim donatıcısının bir parçası değil.

TopLeft 1

Seçim donatıcısının sol üst tutamacı.

Top 2

Seçim donatıcısının üst orta tutamacı.

TopRight 3

Seçim donatıcısının sağ üst tutamacı.

Right 4

Seçim donatıcısının sağ kenarındaki orta tutamaç.

BottomRight 5

Seçim donatıcısının sağ alt tutamacı.

Bottom 6

Seçim donatıcısının alt orta tutamacı.

BottomLeft 7

Seçim donatıcısının sol alt tutamacı.

Left 8

Seçim donatıcısının sol kenarındaki orta tutamaç.

Selection 9

Seçim donatıcısının sınırları içindeki alan.

Örnekler

Aşağıdaki örnekte, sürükleyip bırakma işlemini başlatmak için bir DataObject oluşturulup oluşturulmayacağının nasıl belirleneceği HitTestSelection gösterilmektedir. İki InkCanvas nesne arasında sürükle ve bırak uygulamak için bkz . Nasıl yapılır: Mürekkep Sürükleme ve Bırakma.

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

Açıklamalar

yöntemi, HitTestSelection seçim donatıcısının hangi bölümünün bir InkCanvasSelectionHitResult ile kesişdiğini veya çevrelediğini belirtmek için bir Pointdöndürür. Bu, sürükle ve bırak işlemleri gerçekleştirirken kullanışlıdır.

XAML Metin Kullanımı

Bu sınıf genellikle XAML'de kullanılmaz.

Şunlara uygulanır