다음을 통해 공유


IStylusAsyncPlugin.StylusDown Method

IStylusAsyncPlugin.StylusDown Method

Informs the implementing plug-in that the Stylus has touched the digitizer.

Definition

Visual Basic .NET Public Sub StylusDown( _
ByVal sender As RealTimeStylus, _
ByVal data As StylusDownData _
)
C# public void StylusDown(
RealTimeStylus sender,
StylusDownData data
);
Managed C++ public: void StylusDown(
RealTimeStylus *sender,
StylusDownData *data
);

Parameters

sender Microsoft.StylusInput.RealTimeStylus. The RealTimeStylus that sent the notification.
data Microsoft.StylusInput.PluginData.StylusDownData. Contains information about the stylus.

Examples

[C#]

This C# example, adapted from the RealTimeStylus Plug-in Sample, shows an implementation of StylusDown. It draws a purple circle around the point where the stylus touches the digitizer. The myGraphics variable holds an internal reference to a Graphics Leave Site 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);
    }
}

See Also