StylusShape 类

定义

表示触笔的笔尖。Represents the tip of a stylus.

public ref class StylusShape abstract
public abstract class StylusShape
type StylusShape = class
Public MustInherit Class StylusShape
继承
StylusShape
派生

示例

下面的示例演示如何创建StylusShape并将其传递GetIncrementalStrokeHitTester给方法以Stroke擦除的一部分。The following example demonstrates how to create a StylusShape and pass it to the GetIncrementalStrokeHitTester method to erase a portion of a Stroke. 此示例假设有一个IncrementalStrokeHitTester被调用eraseTester的, 并且其StrokeHit事件已连接到此示例中定义的事件处理程序。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 allows 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

注解

StylusShape指定触笔笔尖的形状、宽度和高度。The StylusShape specifies the shape, width, and height of the tip of a stylus. 和等方法使用StylusShape来确定命中笔画的触笔笔尖。 HitTest EraseMethods such as Erase and HitTest use a StylusShape to determine the stylus tip of the hitting stroke. EllipseStylusShapeRectangleStylusShape 类继承自 StylusShapeThe EllipseStylusShape and RectangleStylusShape classes inherit from StylusShape.

XAML 文本用法XAML Text Usage

此类通常不在 XAML 中使用。This class is not typically used in XAML.

属性

Height

获取触笔的高度。Gets the height of the stylus.

Rotation

获取触笔的角度。Gets the angle of the stylus.

Width

获取触笔的宽度。Gets the width of the stylus.

方法

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于