共用方式為


StrokeCollection.GetIncrementalLassoHitTester(Int32) 方法

定義

建立使用套索 (徒手) 路徑點擊測試 IncrementalLassoHitTesterStrokeCollection

public:
 System::Windows::Ink::IncrementalLassoHitTester ^ GetIncrementalLassoHitTester(int percentageWithinLasso);
public System.Windows.Ink.IncrementalLassoHitTester GetIncrementalLassoHitTester (int percentageWithinLasso);
member this.GetIncrementalLassoHitTester : int -> System.Windows.Ink.IncrementalLassoHitTester
Public Function GetIncrementalLassoHitTester (percentageWithinLasso As Integer) As IncrementalLassoHitTester

參數

percentageWithinLasso
Int32

每一個 Stroke 的最小百分比,這個百分比必須包含在套索內才能被視為點擊。

傳回

點擊測試 IncrementalLassoHitTesterStrokeCollection

範例

下列範例示範如何取得 IncrementalLassoHitTester 可讓使用者使用套索工具選取筆劃的 。 若要建立可讓使用者選取筆跡的控制項,請參閱 如何:從自訂控制項選取筆跡

private void InitializeHitTester(StylusPointCollection collectedPoints)
{
    // Deselect any selected strokes.
    foreach (Stroke selectedStroke in selectedStrokes)
    {
        selectedStroke.DrawingAttributes.Color = inkDA.Color;
    }
    selectedStrokes.Clear();

    if (mode == InkMode.Select)
    {
        // Remove the previously drawn lasso, if it exists.
        if (lassoPath != null)
        {
            presenter.Strokes.Remove(lassoPath);
            lassoPath = null;
        }

        selectionTester =
            presenter.Strokes.GetIncrementalLassoHitTester(80);
        selectionTester.SelectionChanged += 
            new LassoSelectionChangedEventHandler(selectionTester_SelectionChanged);
        selectionTester.AddPoints(collectedPoints);
    }
}
Private Sub InitializeHitTester(ByVal collectedPoints As StylusPointCollection)
    ' Deselect any selected strokes.
    Dim selectedStroke As Stroke
    For Each selectedStroke In selectedStrokes
        selectedStroke.DrawingAttributes.Color = inkDA.Color
    Next selectedStroke
    selectedStrokes.Clear()


    If mode = InkMode.SelectMode Then

        ' Remove the previously drawn lasso, if it exists.
        If Not (lassoPath Is Nothing) Then
            presenter.Strokes.Remove(lassoPath)
            lassoPath = Nothing
        End If

        selectionTester = presenter.Strokes.GetIncrementalLassoHitTester(80)
        AddHandler selectionTester.SelectionChanged, AddressOf selectionTester_SelectionChanged
        selectionTester.AddPoints(collectedPoints)
    End If

End Sub

備註

方法 GetIncrementalLassoHitTesterIncrementalLassoHitTester 傳回 ,當 Stroke 套索路徑括住它時,會將 視為「點擊」。 這適用于實作功能,例如使用套索工具選取筆劃的能力。 會 InkCanvas 使用 來 IncrementalLassoHitTester 實作套索選取工具。

適用於