Metodo Stroke.SetPacketValuesByProperty (Guid, Int32, array<Int32[])
Aggiornamento: novembre 2007
Imposta i dati per una proprietà del pacchetto specificata per un pacchetto nell'oggetto Stroke.
Spazio dei nomi: Microsoft.Ink
Assembly: Microsoft.Ink (in Microsoft.Ink.dll)
'Dichiarazione
Public Function SetPacketValuesByProperty ( _
id As Guid, _
index As Integer, _
packetValues As Integer() _
) As Integer
'Utilizzo
Dim instance As Stroke
Dim id As Guid
Dim index As Integer
Dim packetValues As Integer()
Dim returnValue As Integer
returnValue = instance.SetPacketValuesByProperty(id, _
index, packetValues)
public int SetPacketValuesByProperty(
Guid id,
int index,
int[] packetValues
)
public:
int SetPacketValuesByProperty(
Guid id,
int index,
array<int>^ packetValues
)
public int SetPacketValuesByProperty(
Guid id,
int index,
int[] packetValues
)
public function SetPacketValuesByProperty(
id : Guid,
index : int,
packetValues : int[]
) : int
- id
Tipo: System.Guid
Identificatore Guid tratto dall'oggetto PacketProperty utilizzato per selezionare quali dati del pacchetto vengono impostati. Utilizzare la proprietà PacketDescription per determinare le proprietà definite per questo oggetto Stroke.
- index
Tipo: System.Int32
Indice iniziale del pacchetto da modificare.
- packetValues
Tipo: array<System.Int32[]
Matrice di 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.
Tipo: System.Int32
Restituisce il numero effettivo di pacchetti.
Questo metodo genera un'eccezione se la matrice packetValues ha una lunghezza non corretta.
In questo esempio, ogni oggetto Stroke selezionato di un oggetto InkOverlay viene modificato in modo che ogni punto della seconda metà del tratto contenga il valore massimo consentito del pacchetto NormalPressure.
Tramite il metodo GetPacketValuesByProperty si ottengono i valori del pacchetto NormalPressure per la seconda metà dell'oggetto Stroke. I valori vengono quindi impostati sul valore massimo consentito (ottenuto tramite il metodo GetPacketDescriptionPropertyMetrics) e riapplicati al tratto tramite il metodo 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)
' get the starting point
Dim startPt As Integer = S.PacketCount / 2
' get the NormalPressure values starting at startPt
Dim npValues() As Integer = S.GetPacketValuesByProperty(PacketProperty.NormalPressure, startPt)
' set the NormalPressure values to max
For k As Integer = 0 To npValues.Length - 1
npValues(k) = metrics.Maximum
Next
' set the NormalPressure values starting at startPt
S.SetPacketValuesByProperty(PacketProperty.NormalPressure, startPt, 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);
// get the starting point
int startPt = S.PacketCount / 2;
// get the NormalPressure values starting at startPt
int[] npValues = S.GetPacketValuesByProperty(PacketProperty.NormalPressure, startPt);
// set the NormalPressure values to max
for (int k = 0; k < npValues.Length; k++)
{
npValues[k] = metrics.Maximum;
}
// set the NormalPressure values starting at startPt
S.SetPacketValuesByProperty(PacketProperty.NormalPressure, startPt, 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 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.
Supportato in: 3.0