Bewerken

Share via


EllipseStylusShape Constructors

Definition

Initializes a new instance of the EllipseStylusShape class.

Overloads

EllipseStylusShape(Double, Double)

Initializes a new instance of the EllipseStylusShape class with the specified width and height.

EllipseStylusShape(Double, Double, Double)

Initializes a new instance of the EllipseStylusShape class with the specified width, height, and angle.

Remarks

The following example demonstrates how to create an EllipseStylusShape and pass it to the GetIncrementalStrokeHitTester method to erase a portion of a Stroke. This example assumes that there is a IncrementalStrokeHitTester called eraseTester and that its StrokeHit event has been connected to the event handler defined in this example. 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

EllipseStylusShape(Double, Double)

Initializes a new instance of the EllipseStylusShape class with the specified width and height.

public:
 EllipseStylusShape(double width, double height);
public EllipseStylusShape (double width, double height);
new System.Windows.Ink.EllipseStylusShape : double * double -> System.Windows.Ink.EllipseStylusShape
Public Sub New (width As Double, height As Double)

Parameters

width
Double

The width of the stylus shape.

height
Double

The height of the stylus shape.

Examples

The following example demonstrates how to create an EllipseStylusShape and pass it to the GetIncrementalStrokeHitTester method to erase a portion of a Stroke. This example assumes that there is a IncrementalStrokeHitTester called eraseTester and that its StrokeHit event has been connected to the event handler defined in this example. 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

Applies to

EllipseStylusShape(Double, Double, Double)

Initializes a new instance of the EllipseStylusShape class with the specified width, height, and angle.

public:
 EllipseStylusShape(double width, double height, double rotation);
public EllipseStylusShape (double width, double height, double rotation);
new System.Windows.Ink.EllipseStylusShape : double * double * double -> System.Windows.Ink.EllipseStylusShape
Public Sub New (width As Double, height As Double, rotation As Double)

Parameters

width
Double

The width of the stylus shape.

height
Double

The height of the stylus shape.

rotation
Double

The angle of the stylus shape.

Examples

The following example demonstrates how to create an EllipseStylusShape and pass it to the GetIncrementalStrokeHitTester method to erase a portion of a Stroke. This example assumes that there is a IncrementalStrokeHitTester called eraseTester and that its StrokeHit event has been connected to the event handler defined in this example. 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

Applies to