StrokeCollection.GetIncrementalLassoHitTester(Int32) Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Crea un oggetto IncrementalLassoHitTester che verifica l'oggetto StrokeCollection con un percorso lasso (mano libera).
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
Parametri
- percentageWithinLasso
- Int32
Percentuale minima di ognuna Stroke che deve essere contenuta all'interno del lasso per essere considerata hit.
Valori restituiti
Oggetto IncrementalLassoHitTester che esegue l'hit test dell'oggetto StrokeCollection.
Esempio
Nell'esempio seguente viene illustrato come ottenere un oggetto IncrementalLassoHitTester che consente a un utente di selezionare tratti con uno strumento lazo. Per creare un controllo che consenta a un utente di selezionare l'input penna, vedere Procedura: Selezionare input penna da un controllo personalizzato.
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
Commenti
Il GetIncrementalLassoHitTester metodo restituisce un oggetto IncrementalLassoHitTester che considera " Stroke hit" quando il percorso lasso lo circonda. Ciò è utile per l'implementazione di funzionalità, ad esempio la possibilità di selezionare un tratto con uno strumento lazo. InkCanvas usa un IncrementalLassoHitTester oggetto per implementare lo strumento di selezione lazo.