Поделиться через


IStylusAsyncPlugin.StylusDown - метод

Обновлен: Ноябрь 2007

Notifies the implementing plug-in that the stylus has touched the digitizer surface.

Пространство имен:  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
)

Параметры

Заметки

You can modify the packet data by calling the inherited SetData method of the StylusDownData object contained in the data parameter.

ms585061.alert_note(ru-ru,VS.90).gifПримечание.

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, adapted from the RealTimeStylus Plug-in Sample, shows an implementation of the StylusDown method. The example draws a purple circle around the point where the stylus touches the digitizer. The myGraphics variable holds an internal reference to a Graphics object for the control the RealTimeStylus is attached to.

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);
    }
}

This Microsoft Visual Basic .NET example, adapted from the RealTimeStylus Plug-in Sample, shows an implementation of the StylusDown method. The example draws a purple circle around the point where the stylus touches the digitizer. The myGraphics variable holds an internal reference to a Graphics object for the control the RealTimeStylus is attached to.

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 с пакетом обновления 2 (SP2), Windows Server 2003

Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.

Сведения о версии

.NET Framework

Поддерживается в версии: 3.0

См. также

Ссылки

IStylusAsyncPlugin Интерфейс

IStylusAsyncPlugin - члены

Microsoft.StylusInput - пространство имен

StylusDownData