Stroke.GetPacketDescriptionPropertyMetrics 方法
返回给定数据包 说明类型的规格。
命名空间: 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
参数
- id
类型:System.Guid
PacketProperty 对象的 Guid,用于标识要获取其规格的属性。
返回值
类型:Microsoft.Ink.TabletPropertyMetrics
返回给定数据包 说明类型的规格。
示例
在此示例中,修改 InkOverlay 对象的所有选定 Stroke 对象,以便该笔画的后半部分的每个点包含允许的最大 NormalPressure 数据包值。
使用 GetPacketValuesByProperty 方法获取 Stroke 对象的后半部分的 NormalPressure 数据包值。然后,使用 SetPacketValuesByProperty 方法将这些值设置为最大允许值(通过 GetPacketDescriptionPropertyMetrics 方法获取),并将这些值重新应用于该笔画。
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.GetPacketValuesByProperty