Condividi tramite


Metodo Stroke.SetPacketValuesByProperty (Guid, array<Int32[])

Aggiornamento: novembre 2007

Imposta i dati per una proprietà del pacchetto specificata per tutti i pacchetti nell'oggetto Stroke.

Spazio dei nomi:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Sintassi

'Dichiarazione
Public Function SetPacketValuesByProperty ( _
    id As Guid, _
    packetValues As Integer() _
) As Integer
'Utilizzo
Dim instance As Stroke
Dim id As Guid
Dim packetValues As Integer()
Dim returnValue As Integer

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

Parametri

  • packetValues
    Tipo: array<System.Int32[]
    Matrice dei valori dei dati del pacchetto. Il metodo ha esito negativo se uno qualsiasi dei valori della matrice supera il valore minimo o massimo della proprietà. Per determinare l'intervallo di valori nella proprietà, chiamare il metodo GetPacketDescriptionPropertyMetrics.

Valore restituito

Tipo: System.Int32
Restituisce il numero effettivo di pacchetti.

Note

Tutti i pacchetti vengono modificati.

Questo metodo genera un'eccezione se la matrice packetValues ha una lunghezza non corretta.

Esempi

In questo esempio, ogni oggetto Stroke selezionato di un oggetto InkOverlay viene modificato in modo che il pacchetto NormalPressure aumenti sempre o rimanga costante in tutti i punti del tratto.

Tramite il metodo GetPacketValuesByProperty si ottengono e vengono elencati in ordine crescente i valori del pacchetto NormalPressure per l'oggetto Stroke. I valori ordinati vengono quindi riapplicati al tratto tramite il metodo SetPacketValuesByProperty.

Try
    For Each S As Stroke In mInkOverlay.Selection
        ' get the NormalPressure values
        Dim npValues() As Integer = S.GetPacketValuesByProperty(PacketProperty.NormalPressure)
        ' sort them
        Array.Sort(npValues)
        ' set the NormalPressure values
        S.SetPacketValuesByProperty(PacketProperty.NormalPressure, 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 NormalPressure values
        int[] npValues = S.GetPacketValuesByProperty(PacketProperty.NormalPressure);
        // sort them
        Array.Sort(npValues);
        // set the NormalPressure values
        S.SetPacketValuesByProperty(PacketProperty.NormalPressure, 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
}

Piattaforme

Windows Vista

.NET Framework e .NET Compact Framework non supportano tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.

Informazioni sulla versione

.NET Framework

Supportato in: 3.0

Vedere anche

Riferimenti

Stroke Classe

Membri Stroke

Overload SetPacketValuesByProperty

Spazio dei nomi Microsoft.Ink

PacketProperty

Stroke.GetPacketDescriptionPropertyMetrics