Поделиться через


InkPicture.HitTestSelection - метод

Обновлен: Ноябрь 2007

Returns a value that indicates which part of a selection, if any, was hit during a hit test.

Пространство имен:  Microsoft.Ink
Сборка:  Microsoft.Ink (в Microsoft.Ink.dll)

Синтаксис

'Декларация
Public Function HitTestSelection ( _
    X As Integer, _
    Y As Integer _
) As SelectionHitResult
'Применение
Dim instance As InkPicture
Dim X As Integer
Dim Y As Integer
Dim returnValue As SelectionHitResult

returnValue = instance.HitTestSelection(X, _
    Y)
public SelectionHitResult HitTestSelection(
    int X,
    int Y
)
public:
SelectionHitResult HitTestSelection(
    int X, 
    int Y
)
public SelectionHitResult HitTestSelection(
    int X,
    int Y
)
public function HitTestSelection(
    X : int, 
    Y : int
) : SelectionHitResult

Параметры

  • X
    Тип: System.Int32
    The x-position, in pixels, of the hit test.
  • Y
    Тип: System.Int32
    The y-position, in pixels, of the hit test.

Возвращаемое значение

Тип: Microsoft.Ink.SelectionHitResult
A member of the SelectionHitResult enumeration, which specifies which part of a selection, if any, was hit during a hit test.

Заметки

This method is only useful if the InkPicture.EditingMode property is set to Select.

Примеры

In this example, when the MouseDown() event fires, a check is made to see if EditingMode is set to Select. If so, the HitTestSelection method is called to determine which part of the selection (if any) has been hit. If the hit occurs on any of the four main compass directions, as specified by the SelectionHitResult enumeration, the stroke objects that are selected are changed to a different color.

Private Sub mInkPicture_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs)

    If InkOverlayEditingMode.Select = mInkPicture.EditingMode Then
        Select Case mInkObject.HitTestSelection(e.X, e.Y)
            Case SelectionHitResult.North
                ChangeSelectionColor(Color.Green)
            Case SelectionHitResult.East
                ChangeSelectionColor(Color.Red)
            Case SelectionHitResult.South
                ChangeSelectionColor(Color.Purple)
            Case SelectionHitResult.West
                ChangeSelectionColor(Color.Blue)
        End Select
    End If
End Sub
private void mInkPicture_MouseDown(object sender, MouseEventArgs e)
{
    if (InkOverlayEditingMode.Select == mInkPicture.EditingMode)
    {
        switch (mInkObject.HitTestSelection(e.X, e.Y))
        {
            case SelectionHitResult.North:
                ChangeSelectionColor(Color.Green);
                break;
            case SelectionHitResult.East:
                ChangeSelectionColor(Color.Red);
                break;
            case SelectionHitResult.South:
                ChangeSelectionColor(Color.Purple);
                break;
            case SelectionHitResult.West:
                ChangeSelectionColor(Color.Blue);
                break;
        }
    }
}

Платформы

Windows Vista

Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.

Сведения о версии

.NET Framework

Поддерживается в версии: 3.0

См. также

Ссылки

InkPicture Класс

InkPicture - члены

Microsoft.Ink - пространство имен

SelectionHitResult