StylusDevice.GetStylusPoints 方法

定义

返回一个 StylusPointCollection,其中包含从触笔收集的 StylusPoint 对象。

重载

GetStylusPoints(IInputElement)

返回一个 StylusPointCollection,其中包含从触笔收集的 StylusPoint 对象。

GetStylusPoints(IInputElement, StylusPointDescription)

返回一个 StylusPointCollection,其中包含从触笔收集的 StylusPoint 对象。 使用指定的 StylusPointDescription

GetStylusPoints(IInputElement)

返回一个 StylusPointCollection,其中包含从触笔收集的 StylusPoint 对象。

public:
 System::Windows::Input::StylusPointCollection ^ GetStylusPoints(System::Windows::IInputElement ^ relativeTo);
public System.Windows.Input.StylusPointCollection GetStylusPoints (System.Windows.IInputElement relativeTo);
member this.GetStylusPoints : System.Windows.IInputElement -> System.Windows.Input.StylusPointCollection
Public Function GetStylusPoints (relativeTo As IInputElement) As StylusPointCollection

参数

relativeTo
IInputElement

IInputElement (x,y) 坐标 StylusPointCollection 映射到的 。

返回

一个包含触笔收集的 StylusPointCollection 对象的 StylusPoint

例外

relativeTo 既不是 UIElement 也不是 FrameworkContentElement

示例

以下示例演示如何从 StylusDevice获取 StylusPointCollection

StylusPointCollection myStylusPoints =
            myStylusDevice.GetStylusPoints(myStylusDevice.Target);
textbox1.AppendText("Got " + myStylusPoints.Count.ToString() + " packets\n");
Dim myStylusPoints As StylusPointCollection = _
    myStylusDevice.GetStylusPoints(myStylusDevice.Target)
textbox1.AppendText("Got " + myStylusPoints.Count.ToString() + " packets" + vbCrLf)

适用于

GetStylusPoints(IInputElement, StylusPointDescription)

返回一个 StylusPointCollection,其中包含从触笔收集的 StylusPoint 对象。 使用指定的 StylusPointDescription

public:
 System::Windows::Input::StylusPointCollection ^ GetStylusPoints(System::Windows::IInputElement ^ relativeTo, System::Windows::Input::StylusPointDescription ^ subsetToReformatTo);
public System.Windows.Input.StylusPointCollection GetStylusPoints (System.Windows.IInputElement relativeTo, System.Windows.Input.StylusPointDescription subsetToReformatTo);
member this.GetStylusPoints : System.Windows.IInputElement * System.Windows.Input.StylusPointDescription -> System.Windows.Input.StylusPointCollection
Public Function GetStylusPoints (relativeTo As IInputElement, subsetToReformatTo As StylusPointDescription) As StylusPointCollection

参数

relativeTo
IInputElement

IInputElement (x y) 坐标 StylusPointCollection 映射到的 。

返回

一个包含从触笔收集的 StylusPointCollection 对象的 StylusPoint

例外

relativeTo 既不是 UIElement 也不是 FrameworkContentElement

示例

以下示例演示如何从当前 StylusDevice获取 StylusPoint 对象。

StylusDevice currentStylus = Stylus.CurrentStylusDevice;
StylusPointDescription description1 =
      new StylusPointDescription(new StylusPointPropertyInfo[]
                    {
                        new StylusPointPropertyInfo(StylusPointProperties.X),
                        new StylusPointPropertyInfo(StylusPointProperties.Y),
                        new StylusPointPropertyInfo(StylusPointProperties.NormalPressure),
                        new StylusPointPropertyInfo(StylusPointProperties.XTiltOrientation),
                        new StylusPointPropertyInfo(StylusPointProperties.YTiltOrientation),
                        new StylusPointPropertyInfo(StylusPointProperties.BarrelButton)
                    });

StylusPointDescription description2 = currentStylus.GetStylusPoints(inkCanvas1).Description;

StylusPointDescription description3 = 
    StylusPointDescription.GetCommonDescription(description1, description2);

StylusPointCollection points = currentStylus.GetStylusPoints(inkCanvas1, description3);
Dim currentStylus As StylusDevice = Stylus.CurrentStylusDevice

Dim description1 As New StylusPointDescription(New StylusPointPropertyInfo() _
    {New StylusPointPropertyInfo(StylusPointProperties.X), _
     New StylusPointPropertyInfo(StylusPointProperties.Y), _
     New StylusPointPropertyInfo(StylusPointProperties.NormalPressure), _
     New StylusPointPropertyInfo(StylusPointProperties.XTiltOrientation), _
     New StylusPointPropertyInfo(StylusPointProperties.YTiltOrientation), _
     New StylusPointPropertyInfo(StylusPointProperties.BarrelButton)})

Dim description2 As StylusPointDescription = currentStylus.GetStylusPoints(inkCanvas1).Description

Dim description3 As StylusPointDescription = _
                        StylusPointDescription.GetCommonDescription(description1, description2)

Dim points As StylusPointCollection = currentStylus.GetStylusPoints(inkCanvas1, description3)

注解

subsetToReformatTo必须与 方法使用的 GetStylusPoints(IInputElement)StylusPointCollection 属性兼容Description。 在GetCommonDescription调用 GetStylusPoints(IInputElement, StylusPointDescription) 方法之前,使用 方法获取 StylusPointDescription

适用于