IStylusSyncPlugin.StylusUp Method
Assembly: Microsoft.Ink (in microsoft.ink.dll)
void StylusUp ( RealTimeStylus sender, StylusUpData data )
function StylusUp (
sender : RealTimeStylus,
data : StylusUpData
)
Not applicable.
Parameters
- sender
The RealTimeStylus object that sent the notification.
- data
Information about the Stylus object associated with the notification.
You can modify the packet data by calling the inherited SetData method of the StylusUpData object contained in the data parameter.
![]() |
---|
An ArgumentExceptionArgumentException exception is thrown by the SetData method if the length of the array in the value parameter is not equal to the value of the inherited PacketPropertyCount property. |
This C# example is excerpted from the RealTimeStylus Plug-in Sample. The example shows how to restrict pen input to a specified rectangle.
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; } } }
This Microsoft Visual Basic .NET example is excerpted from the RealTimeStylus Plug-in Sample. The example shows how to restrict pen input to a specified rectangle.
Public Sub StylusUp(ByVal sender As RealTimeStylus, ByVal data As StylusUpData) _ Implements IStylusSyncPlugin.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 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.