다음을 통해 공유


Stroke.SetPacketValuesByProperty 메서드 (Guid, Int32, Int32, array<Int32[])

업데이트: 2007년 11월

Stroke 개체의 패킷 범위에 대한 지정된 패킷 속성 데이터를 설정합니다.

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

구문

‘선언
Public Function SetPacketValuesByProperty ( _
    id As Guid, _
    index As Integer, _
    count As Integer, _
    packetValues As Integer() _
) As Integer
‘사용 방법
Dim instance As Stroke
Dim id As Guid
Dim index As Integer
Dim count As Integer
Dim packetValues As Integer()
Dim returnValue As Integer

returnValue = instance.SetPacketValuesByProperty(id, _
    index, count, packetValues)
public int SetPacketValuesByProperty(
    Guid id,
    int index,
    int count,
    int[] packetValues
)
public:
int SetPacketValuesByProperty(
    Guid id, 
    int index, 
    int count, 
    array<int>^ packetValues
)
public int SetPacketValuesByProperty(
    Guid id,
    int index,
    int count,
    int[] packetValues
)
public function SetPacketValuesByProperty(
    id : Guid, 
    index : int, 
    count : int, 
    packetValues : int[]
) : int

매개 변수

  • index
    형식: System.Int32
    수정할 패킷의 시작 인덱스입니다.
  • count
    형식: System.Int32
    수정할 스트로크의 패킷 수와 packetValues의 값 수입니다. 값이 -1이면 모든 패킷이 수정됩니다.
  • packetValues
    형식: array<System.Int32[]
    패킷 데이터 값의 배열입니다. 배열에 속성의 최소값이나 최대값에서 벗어나는 값이 하나라도 있으면 메서드가 실패합니다. 속성의 값 범위를 확인하려면 GetPacketDescriptionPropertyMetrics 메서드를 호출합니다.

반환 값

형식: System.Int32
실제로 설정된 패킷 수를 반환합니다.

설명

packetValues 배열의 길이가 잘못된 경우 이 메서드는 예외를 throw합니다.

예제

이 예제에서는 InkOverlay 개체의 선택된 Stroke 개체를 각각 수정하여 스트로크의 앞쪽 절반에 있는 각 점에 허용되는 최소 NormalPressure 패킷 값을 포함시킵니다.

GetPacketValuesByProperty 메서드를 사용하여 Stroke 개체의 앞쪽 절반에 대한 NormalPressure 패킷 값을 가져옵니다. 그런 다음 GetPacketDescriptionPropertyMetrics 메서드를 통해 가져온 허용되는 최소값으로 설정하고 SetPacketValuesByProperty 메서드를 사용하여 스트로크에 값을 다시 적용합니다.

Try
    For Each S As Stroke In mInkOverlay.Selection
        ' get the PacketProperty.NormalPressure metrics for the stroke
        Dim metrics As TabletPropertyMetrics = S.GetPacketDescriptionPropertyMetrics(PacketProperty.NormalPressure)
        ' we want to get half of the NormalPressure values
        Dim halfWayPt As Integer = S.PacketCount / 2
        ' get the NormalPressure values for the first half of the packets
        Dim npValues() As Integer = S.GetPacketValuesByProperty(PacketProperty.NormalPressure, 0, halfWayPt)
        ' set the NormalPressure values to min
        For k As Integer = 0 To npValues.Length - 1
            npValues(k) = metrics.Minimum
        Next
        ' set the NormalPressure values for the first half of the packets
        S.SetPacketValuesByProperty(PacketProperty.NormalPressure, 0, halfWayPt, npValues)
    Next
Catch ex As ArgumentException
    ' This exception will be raised if PacketProperty.NormalPressure is not supported
    ' This will be the case if creating strokes with a mouse
End Try
try
{
    foreach (Stroke S in mInkOverlay.Selection)
    {
        // get the PacketProperty.NormalPressure metrics for the stroke
        TabletPropertyMetrics metrics = S.GetPacketDescriptionPropertyMetrics(PacketProperty.NormalPressure);
        // we want to get half of the NormalPressure values
        int halfWayPt = S.PacketCount / 2;
        // get the NormalPressure values for the first half of the packets
        int[] npValues = S.GetPacketValuesByProperty(PacketProperty.NormalPressure, 0, halfWayPt);
        // set the NormalPressure values to min
        for (int k = 0; k < npValues.Length; k++)
        {
            npValues[k] = metrics.Minimum;
        }
        // set the NormalPressure values for the first half of the packets
        S.SetPacketValuesByProperty(PacketProperty.NormalPressure, 0, halfWayPt, npValues);
    }
}
catch (ArgumentException)
{
    // This exception will be raised if PacketProperty.NormalPressure is not supported
    // This will be the case if creating strokes with a mouse
}

플랫폼

Windows Vista

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

버전 정보

.NET Framework

3.0에서 지원

참고 항목

참조

Stroke 클래스

Stroke 멤버

SetPacketValuesByProperty 오버로드

Microsoft.Ink 네임스페이스

PacketProperty

Stroke.GetPacketDescriptionPropertyMetrics