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