TabletPropertyMetrics 結構
定義「封包」屬性的範圍和解析。
命名空間: Microsoft.Ink
組件: Microsoft.Ink (在 Microsoft.Ink.dll 中)
'宣告
Public Structure TabletPropertyMetrics
'用途
Dim instance As TabletPropertyMetrics
public struct TabletPropertyMetrics
public value class TabletPropertyMetrics
public final class TabletPropertyMetrics extends ValueType
JScript 支援使用結構,但不支援新結構的宣告。
在呼叫 Tablet.GetPropertyMetrics 或 Stroke.GetPacketDescriptionPropertyMetrics 方法時,您會建立 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
}
這個型別的任何 Public static (在 Visual Basic 中為 Shared) 成員都具備執行緒安全。並非所有的執行個體成員都是安全執行緒。
Windows Vista
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
支援版本:3.0