共用方式為


Stroke.GetPacketDescriptionPropertyMetrics 方法

傳回指定「封包」描述類型的度量資訊 (Metric)。

命名空間:  Microsoft.Ink
組件:  Microsoft.Ink (在 Microsoft.Ink.dll 中)

語法

'宣告
Public Function GetPacketDescriptionPropertyMetrics ( _
    id As Guid _
) As TabletPropertyMetrics
'用途
Dim instance As Stroke
Dim id As Guid
Dim returnValue As TabletPropertyMetrics

returnValue = instance.GetPacketDescriptionPropertyMetrics(id)
public TabletPropertyMetrics GetPacketDescriptionPropertyMetrics(
    Guid id
)
public:
TabletPropertyMetrics GetPacketDescriptionPropertyMetrics(
    Guid id
)
public TabletPropertyMetrics GetPacketDescriptionPropertyMetrics(
    Guid id
)
public function GetPacketDescriptionPropertyMetrics(
    id : Guid
) : TabletPropertyMetrics

參數

傳回值

型別:Microsoft.Ink.TabletPropertyMetrics
傳回指定「封包」描述類型的度量資訊。

範例

在這個範例中,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)
        ' 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 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求

版本資訊

.NET Framework

支援版本:3.0

請參閱

參考

Stroke 類別

Stroke 成員

Microsoft.Ink 命名空間

Stroke.GetPacketValuesByProperty

Stroke.SetPacketValuesByProperty

Tablet.GetPropertyMetrics