StrokeCollection.GetIncrementalLassoHitTester(Int32) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立使用套索 (徒手) 路徑點擊測試 IncrementalLassoHitTester 的 StrokeCollection。
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
參數
傳回
點擊測試 IncrementalLassoHitTester 的 StrokeCollection。
範例
下列範例示範如何取得 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
備註
方法 GetIncrementalLassoHitTester 會 IncrementalLassoHitTester 傳回 ,當 Stroke 套索路徑括住它時,會將 視為「點擊」。 這適用于實作功能,例如使用套索工具選取筆劃的能力。 會 InkCanvas 使用 來 IncrementalLassoHitTester 實作套索選取工具。