IStylusAsyncPlugin.StylusUp - метод
Обновлен: Ноябрь 2007
Notifies the implementing plug-in that the user has raised the stylus off of the tablet digitizer surface.
Пространство имен: 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
The RealTimeStylus object that sent the notification.
- data
Тип: Microsoft.StylusInput.PluginData.StylusUpData
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 ArgumentException 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 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 с пакетом обновления 2 (SP2), Windows Server 2003
Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.
Сведения о версии
.NET Framework
Поддерживается в версии: 3.0