IStylusAsyncPlugin.StylusUp 方法
通知實作外掛程式,使用者已舉起手寫筆離開數位手寫板介面。
命名空間: Microsoft.StylusInput
組件: Microsoft.Ink (在 Microsoft.Ink.dll 中)
語法
'宣告
Sub StylusUp ( _
sender As RealTimeStylus, _
data As StylusUpData _
)
'用途
Dim instance As IStylusAsyncPlugin
Dim sender As RealTimeStylus
Dim data As StylusUpData
instance.StylusUp(sender, data)
void StylusUp(
RealTimeStylus sender,
StylusUpData data
)
void StylusUp(
RealTimeStylus^ sender,
StylusUpData^ data
)
void StylusUp(
RealTimeStylus sender,
StylusUpData data
)
function StylusUp(
sender : RealTimeStylus,
data : StylusUpData
)
參數
- sender
型別:Microsoft.StylusInput.RealTimeStylus
已傳送告知的 RealTimeStylus 物件。
- data
型別:Microsoft.StylusInput.PluginData.StylusUpData
與告知相關聯之 Stylus 物件的相關資訊。
備註
您可以透過呼叫 data 參數中所包含 StylusUpData 物件的繼承 SetData 方法來修改封包資料。
注意事項: |
---|
如果 value 參數中的陣列長度不等於所繼承的 PacketPropertyCount 屬性的值,SetData 方法會擲回 ArgumentException (英文) 例外狀況。 |
範例
這個 C# 範例摘錄自 RealTimeStylus Plug-in Sample。在這個範例中,會說明如何限制畫筆輸入至指定的矩形。
public void StylusUp(RealTimeStylus sender, StylusUpData data)
{
ModifyPacketData(data);
}
private void ModifyPacketData(StylusDataBase data)
{
// For each packet in the packet data, check whether
// its x,y values fall outside of the specified rectangle.
// If so, replace them with the nearest point that still
// falls within the rectangle.
for (int i = 0; i < data.Count ; i += data.PacketPropertyCount)
{
// packet data always has x followed by y followed by the rest
int x = data[i];
int y = data[i+1];
// Constrain points to the input rectangle
x = Math.Max(x, rectangle.Left);
x = Math.Min(x, rectangle.Right);
y = Math.Max(y, rectangle.Top);
y = Math.Min(y, rectangle.Bottom);
// If necessary, modify the x,y packet data
if (x != data[i])
{
data[i] = x;
}
if (y != data[i+1])
{
data[i+1] = y;
}
}
}
這個 Microsoft Visual Basic .NET 範例摘錄自 RealTimeStylus Plug-in Sample。在這個範例中,會說明如何限制畫筆輸入至指定的矩形。
Public Sub StylusUp(ByVal sender As RealTimeStylus, ByVal data As StylusUpData) _
Implements IStylusAsyncPlugin.StylusUp
ModifyPacketData(data)
End Sub 'StylusUp
Private Sub ModifyPacketData(ByVal data As StylusDataBase)
' For each packet in the packet data, check whether
' its x,y values fall outside of the specified rectangle.
' If so, replace them with the nearest point that still
' falls within the rectangle.
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 x As Integer = data(i)
Dim y As Integer = data((i + 1))
' Constrain points to the input rectangle
x = Math.Max(x, rectangle.Left)
x = Math.Min(x, rectangle.Right)
y = Math.Max(y, rectangle.Top)
y = Math.Min(y, rectangle.Bottom)
' If necessary, modify the x,y packet data
If x <> data(i) Then
data(i) = x
End If
If y <> data((i + 1)) Then
data((i + 1)) = y
End If
Next i
End Sub 'ModifyPacketData
平台
Windows Vista, Windows XP SP2, Windows Server 2003
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
版本資訊
.NET Framework
支援版本:3.0