StrokeCollection.GetIncrementalStrokeHitTester(StylusShape) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates an IncrementalStrokeHitTester that hit tests the StrokeCollection with an erasing path.
public:
System::Windows::Ink::IncrementalStrokeHitTester ^ GetIncrementalStrokeHitTester(System::Windows::Ink::StylusShape ^ eraserShape);
public System.Windows.Ink.IncrementalStrokeHitTester GetIncrementalStrokeHitTester(System.Windows.Ink.StylusShape eraserShape);
member this.GetIncrementalStrokeHitTester : System.Windows.Ink.StylusShape -> System.Windows.Ink.IncrementalStrokeHitTester
Public Function GetIncrementalStrokeHitTester (eraserShape As StylusShape) As IncrementalStrokeHitTester
- eraserShape
- StylusShape
A StylusShape that specifies the tip of the stylus.
An IncrementalStrokeHitTester that hit tests the StrokeCollection.
The following example demonstrates how to get an IncrementalStrokeHitTester that can be used to erase part of a Stroke. To create a control that enables a user to erase ink, see How to: Erase Ink on a Custom Control.
// 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));
}
' 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
The GetIncrementalStrokeHitTester method returns an IncrementalStrokeHitTester that considers a Stroke to be "hit" when the eraser path intersects it. This is useful for implementing features, such as the ability to erase part of a Stroke. The InkCanvas uses an IncrementalStrokeHitTester when the EditingMode property is set to EraseByPoint.
Produk | Versi |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
.NET maklum balas
.NET ialah projek sumber terbuka. Pilih pautan untuk memberikan maklum balas: