IncrementalHitTester 클래스

정의

Stroke에 대한 적중 테스트를 동적으로 수행합니다.

public ref class IncrementalHitTester abstract
public abstract class IncrementalHitTester
type IncrementalHitTester = class
Public MustInherit Class IncrementalHitTester
상속
IncrementalHitTester
파생

예제

다음 예제에서는 요소를 추가 하는 방법에 설명 합니다 IncrementalHitTester 사용자 스타일러스를 사용 하 여 데이터를 입력 하는 경우. 예제에 포함 되어는 StrokeHit 의 일부는 이벤트 처리기는 Stroke 사용자 교차 하는 합니다. 사용자가 잉크를 지울 수 있도록 하는 컨트롤을 만들려면 참조 방법: 사용자 지정 컨트롤에서 잉크 지우기합니다.


// Prepare to collect stylus packets. Get the 
// IncrementalHitTester from the InkPresenter's 
// StrokeCollection and subscribe to its StrokeHitChanged event.
protected override void OnStylusDown(StylusDownEventArgs e)
{
    base.OnStylusDown(e);

    EllipseStylusShape eraserTip = new EllipseStylusShape(3, 3, 0);
    eraseTester = 
        presenter.Strokes.GetIncrementalStrokeHitTester(eraserTip);
    eraseTester.StrokeHit += new StrokeHitEventHandler(eraseTester_StrokeHit);
    eraseTester.AddPoints(e.GetStylusPoints(this));
}

// Collect the StylusPackets as the stylus moves.
protected override void OnStylusMove(StylusEventArgs e)
{
    if (eraseTester.IsValid)
    {
        eraseTester.AddPoints(e.GetStylusPoints(this));
    }
}

// Unsubscribe from the StrokeHitChanged event when the
// user lifts the stylus.
protected override void OnStylusUp(StylusEventArgs e)
{

    eraseTester.AddPoints(e.GetStylusPoints(this));
    eraseTester.StrokeHit -= new
        StrokeHitEventHandler(eraseTester_StrokeHit);
    eraseTester.EndHitTesting();
}

// When the stylus intersects a stroke, erase that part of
// the stroke.  When the stylus dissects a stoke, the 
// Stroke.Erase method returns a StrokeCollection that contains
// the two new strokes.
void eraseTester_StrokeHit(object sender,
    StrokeHitEventArgs args)
{
    StrokeCollection eraseResult =
        args.GetPointEraseResults();
    StrokeCollection strokesToReplace = new StrokeCollection();
    strokesToReplace.Add(args.HitStroke);
   
    // Replace the old stroke with the new one.
    if (eraseResult.Count > 0)
    {
        presenter.Strokes.Replace(strokesToReplace, eraseResult);
    }
    else
    {
        presenter.Strokes.Remove(strokesToReplace);
    }
}

     ' Prepare to collect stylus packets. Get the 
     ' IncrementalHitTester from the InkPresenter's 
     ' StrokeCollection and subscribe to its StrokeHitChanged event.
     Protected Overrides Sub OnStylusDown(ByVal e As StylusDownEventArgs)

         MyBase.OnStylusDown(e)

         Dim eraserTip As New EllipseStylusShape(3, 3, 0)
         eraseTester = presenter.Strokes.GetIncrementalStrokeHitTester(eraserTip)
         AddHandler eraseTester.StrokeHit, _
             AddressOf eraseTester_StrokeHit
         eraseTester.AddPoints(e.GetStylusPoints(Me))

     End Sub

     ' Collect the StylusPackets as the stylus moves.
     Protected Overrides Sub OnStylusMove(ByVal e As StylusEventArgs)

         If eraseTester.IsValid Then
             eraseTester.AddPoints(e.GetStylusPoints(Me))
         End If

     End Sub

     ' Unsubscribe from the StrokeHitChanged event when the
     ' user lifts the stylus.
     Protected Overrides Sub OnStylusUp(ByVal e As StylusEventArgs)

         eraseTester.AddPoints(e.GetStylusPoints(Me))

         RemoveHandler eraseTester.StrokeHit, _
             AddressOf eraseTester_StrokeHit
         eraseTester.EndHitTesting()

     End Sub


     ' When the stylus intersects a stroke, erase that part of
     ' the stroke.  When the stylus dissects a stoke, the 
     ' Stroke.Erase method returns a StrokeCollection that contains
     ' the two new strokes.
     Private Sub eraseTester_StrokeHit(ByVal sender As Object, _
             ByVal args As StrokeHitEventArgs)

         Dim eraseResult As StrokeCollection = _
             args.GetPointEraseResults()
         Dim strokesToReplace As New StrokeCollection()
         strokesToReplace.Add(args.HitStroke)

         ' Replace the old stroke with the new one.
         If eraseResult.Count > 0 Then
             presenter.Strokes.Replace(strokesToReplace, eraseResult)
         Else
             presenter.Strokes.Remove(strokesToReplace)
         End If

     End Sub

설명

합니다 IncrementalHitTester 여부를 사용자 "도달" 동적으로 결정을 Stroke입니다. 이 클래스를 사용 하면 선택 하 고 잉크를 지우는 같은 상황에서 사용자에 게 즉각적인 피드백을 제공할 수 있습니다.

상속 되는 두 가지 IncrementalHitTester:

  • IncrementalLassoHitTester 를 올가미 경로로 둘러싸인 여부를 확인 하 여 스트로크에 대 한 적중 테스트 합니다.

  • IncrementalStrokeHitTester 지우개 경로이 교차 확인 하 여 스트로크에 대 한 적중 테스트 합니다.

다음 표에서 사용자 지정 컨트롤에서 디지털 잉크를 관리 하는 방법을 알아보려면 위치를 나열 합니다.

수행할 작업 참조 문서
디지털 잉크를 수집 하는 컨트롤 만들기 잉크 입력 컨트롤 만들기
사용자가 잉크를 선택할 수 있도록 하는 컨트롤 만들기 방법: 사용자 지정 컨트롤에서 잉크 선택
사용자 지점 지우기 잉크를 사용 하도록 설정 하는 컨트롤 만들기 방법: 사용자 지정 컨트롤에서 잉크 지우기

XAML 텍스트 사용

이 클래스는 XAML에서 일반적으로 사용 되지 않습니다.

속성

IsValid

IncrementalHitTester가 적중 테스트를 수행하고 있는지 여부를 가져옵니다.

메서드

AddPoint(Point)

PointIncrementalHitTester를 추가합니다.

AddPoints(IEnumerable<Point>)

IncrementalHitTester에 점을 추가합니다.

AddPoints(StylusPointCollection)

지정한 StylusPoint 개체를 IncrementalHitTester에 추가합니다.

AddPointsCore(IEnumerable<Point>)

IncrementalHitTester에 점을 추가합니다.

EndHitTesting()

IncrementalHitTester에서 사용하는 리소스를 해제합니다.

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상