IStylusAsyncPlugin.StylusDown 方法
通知实现插件手写笔已接触到数字化仪表面。
命名空间: Microsoft.StylusInput
程序集: Microsoft.Ink(在 Microsoft.Ink.dll 中)
语法
声明
Sub StylusDown ( _
sender As RealTimeStylus, _
data As StylusDownData _
)
用法
Dim instance As IStylusAsyncPlugin
Dim sender As RealTimeStylus
Dim data As StylusDownData
instance.StylusDown(sender, data)
void StylusDown(
RealTimeStylus sender,
StylusDownData data
)
void StylusDown(
RealTimeStylus^ sender,
StylusDownData^ data
)
void StylusDown(
RealTimeStylus sender,
StylusDownData data
)
function StylusDown(
sender : RealTimeStylus,
data : StylusDownData
)
参数
- sender
类型:Microsoft.StylusInput.RealTimeStylus
发送通知的 RealTimeStylus 对象。
- data
类型:Microsoft.StylusInput.PluginData.StylusDownData
有关与手写笔关联的 Stylus 对象的信息。
备注
可以通过调用包含在 data 参数中的 StylusDownData 对象的继承的 SetData 方法来修改数据包数据。
备注
如果 value 参数中数组的长度不等于继承的 PacketPropertyCount 属性的值,则 SetData 方法将引发 ArgumentException 异常。
示例
此 C# 示例改编自 RealTimeStylus Plug-in Sample,演示 StylusDown 方法的实现。此示例围绕手写笔接触数字化仪的点画一个紫色的圈。myGraphics 变量包含对 RealTimeStylus 所附加到的控件的 Graphics 对象的内部引用。
public void StylusDown(RealTimeStylus sender, StylusDownData data)
{
for (int i = 0; i < data.Count; i += data.PacketPropertyCount)
{
// Packet data always has x followed by y followed by the rest
Point point = new Point(data[i], data[i+1]);
// Since the packet data is in Ink Space coordinates, we need to convert to Pixels...
point.X = (int)Math.Round((float)point.X * (float)myGraphics.DpiX/2540.0F);
point.Y = (int)Math.Round((float)point.Y * (float)myGraphics.DpiY/2540.0F);
// Draw a circle corresponding to the packet
myGraphics.DrawEllipse(Pens.Purple, point.X - 2, point.Y - 2, 4, 4);
}
}
此 Microsoft Visual Basic .NET 示例改编自 RealTimeStylus Plug-in Sample,演示 StylusDown 方法的实现。此示例围绕手写笔接触数字化仪的点画一个紫色的圈。myGraphics 变量包含对 RealTimeStylus 所附加到的控件的 Graphics 对象的内部引用。
Public Sub StylusDown(ByVal sender As RealTimeStylus, ByVal data As StylusDownData) _
Implements IStylusAsyncPlugin.StylusDown
Dim i As Integer
For i = 0 To data.Count - data.PacketPropertyCount Step data.PacketPropertyCount
' Packet data always has x followed by y followed by the rest
Dim point As New Point(data(i), data((i + 1)))
' Since the packet data is in Ink Space coordinates, we need to convert to Pixels...
point.X = Math.Round((System.Convert.ToSingle(point.X) * System.Convert.ToSingle(myGraphics.DpiX) / 2540.0F))
point.Y = Math.Round((System.Convert.ToSingle(point.Y) * System.Convert.ToSingle(myGraphics.DpiY) / 2540.0F))
' Draw a circle corresponding to the packet
myGraphics.DrawEllipse(Pens.Purple, point.X - 2, point.Y - 2, 4, 4)
Next i
End Sub 'StylusDown
平台
Windows Vista, Windows XP SP2, Windows Server 2003
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0