Condividi tramite


Struttura TabletPropertyMetrics

Aggiornamento: novembre 2007

Definisce l'intervallo e la risoluzione di una proprietà del pacchetto.

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

Sintassi

'Dichiarazione
Public Structure TabletPropertyMetrics
'Utilizzo
Dim instance As TabletPropertyMetrics
public struct TabletPropertyMetrics
public value class TabletPropertyMetrics
public final class TabletPropertyMetrics extends ValueType
JScript supporta l'utilizzo di strutture ma non la dichiarazione di nuove.

Note

Quando si chiama il metodo Tablet.GetPropertyMetrics o Stroke.GetPacketDescriptionPropertyMetrics viene creata una struttura TabletPropertyMetrics.

Esempi

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
}

Codice thread safe

Qualsiasi membro static (Shared in Visual Basic) pubblico di questo tipo è thread-safe. I membri di istanza non sono garantiti come thread-safe.

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

Membri TabletPropertyMetrics

Spazio dei nomi Microsoft.Ink

Tablet.GetPropertyMetrics

Tablet