다음을 통해 공유


IStylusSyncPlugin.StylusUp 메서드

업데이트: 2007년 11월

구현하는 플러그 인에 사용자가 디지타이저 표면에서 스타일러스를 떼었음을 알립니다.

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

구문

‘선언
Sub StylusUp ( _
    sender As RealTimeStylus, _
    data As StylusUpData _
)
‘사용 방법
Dim instance As IStylusSyncPlugin
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
)

매개 변수

설명

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

참고

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

예제

이 C# 예제는 RealTimeStylus Plug-in Sample에서 가져온 것입니다. 이 예제에서는 펜 입력을 지정된 사각형으로 제한하는 방법을 보여 줍니다.

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

이 Microsoft Visual Basic .NET 예제는 RealTimeStylus Plug-in Sample에서 가져온 것입니다. 이 예제에서는 펜 입력을 지정된 사각형으로 제한하는 방법을 보여 줍니다.

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 Vista, Windows XP SP2, Windows Server 2003

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

버전 정보

.NET Framework

3.0에서 지원

참고 항목

참조

IStylusSyncPlugin 인터페이스

IStylusSyncPlugin 멤버

Microsoft.StylusInput 네임스페이스

StylusUpData