다음을 통해 공유


IStylusSyncPlugin.Packets 메서드

업데이트: 2007년 11월

IStylusSyncPlugin 인터페이스를 구현하는 개체에 디지타이저 표면에서 스타일러스가 이동하고 있음을 알립니다.

네임스페이스:  Microsoft.StylusInput
어셈블리:  Microsoft.Ink(Microsoft.Ink.dll)

구문

‘선언
Sub Packets ( _
    sender As RealTimeStylus, _
    data As PacketsData _
)
‘사용 방법
Dim instance As IStylusSyncPlugin
Dim sender As RealTimeStylus
Dim data As PacketsData

instance.Packets(sender, data)
void Packets(
    RealTimeStylus sender,
    PacketsData data
)
void Packets(
    RealTimeStylus^ sender, 
    PacketsData^ data
)
void Packets(
    RealTimeStylus sender,
    PacketsData data
)
function Packets(
    sender : RealTimeStylus, 
    data : PacketsData
)

매개 변수

설명

data 매개 변수에 들어 있는 PacketsData 개체의 상속된 SetData 메서드를 호출하면 패킷 데이터를 수정할 수 있습니다.

참고

value 매개 변수의 배열 길이가 상속된 PacketPropertyCount 속성 값의 배수가 아니면 SetData 메서드에서 ArgumentException 예외가 throw됩니다.

value 매개 변수를 null(Microsoft Visual Basic .NET의 경우 Nothing)로 설정하고 SetData 메서드를 호출하면 패킷을 취소할 수 있습니다.

예제

이 C# 예제는 RealTimeStylus Plug-in Sample에서 가져온 것입니다. 이 예제에서는 새 패킷이 수신된 각 위치에 작은 원을 그리는 Packets 메서드를 구현합니다.

public void Packets(RealTimeStylus sender,  PacketsData data)
{           
  // For each new packet received, extract the x,y data
  // and draw a small circle around the result.
  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.Green, point.X - 2, point.Y - 2, 4, 4);
  }
}

이 Visual Basic .NET 예제는 RealTimeStylus Plug-in Sample에서 가져온 것입니다. 이 예제에서는 새 패킷이 수신된 각 위치에 작은 원을 그리는 Packets 메서드를 구현합니다.

Public Sub Packets(ByVal sender As RealTimeStylus, ByVal data As PacketsData) _
 Implements IStylusSyncPlugin.Packets
    ' For each new packet received, extract the x,y data
    ' and draw a small circle around the result.
    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.Green, point.X - 2, point.Y - 2, 4, 4)
    Next i
End Sub 'Packets

플랫폼

Windows Vista, Windows XP SP2, Windows Server 2003

.NET Framework 및 .NET Compact Framework에서 모든 플랫폼의 전체 버전을 지원하지는 않습니다. 지원되는 버전의 목록을 보려면 .NET Framework 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

3.0에서 지원

참고 항목

참조

IStylusSyncPlugin 인터페이스

IStylusSyncPlugin 멤버

Microsoft.StylusInput 네임스페이스

RealTimeStylus

Microsoft.StylusInput.PluginData.PacketsData