InkAnalyzerBase.UpdateStrokesData 方法
更新指定笔画的数据包数据。
命名空间: System.Windows.Ink.AnalysisCore
程序集: IACore(在 IACore.dll 中)
语法
声明
Public Sub UpdateStrokesData ( _
strokeIds As Integer(), _
strokePacketCounts As Integer(), _
strokesPacketData As Integer(), _
strokesPacketDescription As Guid() _
)
用法
Dim instance As InkAnalyzerBase
Dim strokeIds As Integer()
Dim strokePacketCounts As Integer()
Dim strokesPacketData As Integer()
Dim strokesPacketDescription As Guid()
instance.UpdateStrokesData(strokeIds, _
strokePacketCounts, strokesPacketData, _
strokesPacketDescription)
public void UpdateStrokesData(
int[] strokeIds,
int[] strokePacketCounts,
int[] strokesPacketData,
Guid[] strokesPacketDescription
)
public:
void UpdateStrokesData(
array<int>^ strokeIds,
array<int>^ strokePacketCounts,
array<int>^ strokesPacketData,
array<Guid>^ strokesPacketDescription
)
public void UpdateStrokesData(
int[] strokeIds,
int[] strokePacketCounts,
int[] strokesPacketData,
Guid[] strokesPacketDescription
)
public function UpdateStrokesData(
strokeIds : int[],
strokePacketCounts : int[],
strokesPacketData : int[],
strokesPacketDescription : Guid[]
)
参数
- strokeIds
类型:array<System.Int32[]
包含笔画标识符的数组。
- strokePacketCounts
类型:array<System.Int32[]
包含每个笔画的数据包数目的数组。
- strokesPacketData
类型:array<System.Int32[]
包含笔画数据包数据的数组。
- strokesPacketDescription
类型:array<System.Guid[]
包含数据包属性标识符的数组。
备注
strokePacketData 包含所有笔画的数据包数据。strokePacketDescription 包含用于描述每个笔画中每个点所包含的数据包数据类型的全局唯一标识符 (GUID)。有关可用数据包属性的完整列表,请参见 Microsoft.Ink.PacketProperty 类。
仅当所有新笔画数据都具有相同的数据包说明时,此方法才更新笔画数据。
此方法不更新墨迹分析器的 DirtyRegion。
如果 strokeIds 中标识的某个笔画不与墨迹分析器相关联,则此方法忽略该标识符。
如果 strokeIds 中标识的任何笔画都不与墨迹分析器相关联,则此方法返回但不更新墨迹分析器。
当 strokeIds 为 nullnull 引用(在 Visual Basic 中为 Nothing) 时,此方法引发 System.ArgumentNullException。
示例
下面的示例定义 UpdateStrokesData 方法,该方法更新指定 InkAnalyzerBase 的笔画数据。此方法将 Strokes 集合转换为数据包数据,并更新墨迹分析器中的笔画数据。实际上,如果应用程序要使用 Microsoft.Ink.Ink 对象存储笔画数据,则应用程序应使用派生的 Microsoft.Ink.InkAnalyzer 类。
''' <summary>
''' Updates the packet data for the specified strokes of an InkAnalyzerBase.
''' </summary>
''' <param name="baseInkAnalyzer">
''' The analyzer that receives the strokes.</param>
''' <param name="theStrokes">
''' The strokes for which to update the stroke data.</param>
''' <remarks>
''' This method converts stroke data to packet data for example only.
''' The InkAnalyzerBase is used when your application is handling packet
''' data. If your application uses stroke data from an Ink object, then
''' you would use InkAnalyzer.
''' </remarks>
Public Shared Sub MyUpdateStrokesData( _
ByVal baseInkAnalyzer As System.Windows.Ink.AnalysisCore.InkAnalyzerBase, _
ByVal theStrokes As Microsoft.Ink.Strokes)
' Check that the parameters are valid
If Nothing Is baseInkAnalyzer Then
Throw New ArgumentNullException("baseInkAnalyzer")
End If
If Nothing Is theStrokes Then
Throw New ArgumentNullException("theStrokes")
End If
If 0 = theStrokes.Count Then
Throw New ArgumentException("Empty strokes collection.")
End If
' Only strokes that have the same packet description GUIDs
' can be added in one call to InkAnalyzerBase.AddStrokes.
Dim thePacketDescription As Guid() = theStrokes(0).PacketDescription
' Accumulate the stroke data in collections.
Dim theStrokeIdentifiers As New ArrayList()
Dim thePacketCounts As New ArrayList()
Dim thePacketData As New ArrayList()
Dim aStroke As Microsoft.Ink.Stroke
For Each aStroke In theStrokes
If Not InkAnalyzerHelper.AreElementwiseEquivalent( _
aStroke.PacketDescription, thePacketDescription) Then
Throw New ApplicationException( _
"The strokes collection contains strokes with" + _
"different packet descriptions.")
End If
' Add the stroke data to the collections.
theStrokeIdentifiers.Add(aStroke.Id)
thePacketCounts.Add(aStroke.PacketCount)
thePacketData.AddRange(aStroke.GetPacketData())
Next aStroke
' Update the stroke data for the base layer ink analyzer.
baseInkAnalyzer.UpdateStrokesData( _
DirectCast(theStrokeIdentifiers.ToArray(GetType(Integer)), Integer()), _
DirectCast(thePacketCounts.ToArray(GetType(Integer)), Integer()), _
DirectCast(thePacketData.ToArray(GetType(Integer)), Integer()), _
thePacketDescription)
End Sub 'UpdateStrokesData '
/// <summary>
/// Updates the packet data for the specified strokes of an InkAnalyzerBase.
/// </summary>
/// <param name="baseInkAnalyzer">
/// The analyzer that receives the strokes.</param>
/// <param name="theStrokes">
/// The strokes for which to update the stroke data.</param>
/// <remarks>
/// This method converts stroke data to packet data for example only.
/// The InkAnalyzerBase is used when your application is handling packet
/// data. If your application uses stroke data from an Ink object, then
/// you would use InkAnalyzer.
/// </remarks>
public static void MyUpdateStrokesData(
System.Windows.Ink.AnalysisCore.InkAnalyzerBase baseInkAnalyzer,
Microsoft.Ink.Strokes theStrokes)
{
// Check that the parameters are valid
if (null == baseInkAnalyzer)
{
throw new ArgumentNullException("baseInkAnalyzer");
}
if (null == theStrokes)
{
throw new ArgumentNullException("theStrokes");
}
if (0 == theStrokes.Count)
{
throw new ArgumentException("Empty strokes collection.");
}
// Only strokes that have the same packet description GUIDs
// can be added in one call to InkAnalyzerBase.AddStrokes.
Guid[] thePacketDescription = theStrokes[0].PacketDescription;
// Accumulate the stroke data in collections.
ArrayList theStrokeIdentifiers = new ArrayList();
ArrayList thePacketCounts = new ArrayList();
ArrayList thePacketData = new ArrayList();
foreach (Microsoft.Ink.Stroke aStroke in theStrokes)
{
if (!InkAnalyzerHelper.AreElementwiseEquivalent(
aStroke.PacketDescription, thePacketDescription))
{
throw new ApplicationException(
"The strokes collection contains strokes with" +
"different packet descriptions.");
}
// Add the stroke data to the collections.
theStrokeIdentifiers.Add(aStroke.Id);
thePacketCounts.Add(aStroke.PacketCount);
thePacketData.AddRange(aStroke.GetPacketData());
}
// Update the stroke data for the base layer ink analyzer.
baseInkAnalyzer.UpdateStrokesData(
theStrokeIdentifiers.ToArray(typeof(int)) as int[],
thePacketCounts.ToArray(typeof(int)) as int[],
thePacketData.ToArray(typeof(int)) as int[],
thePacketDescription);
}
平台
Windows Vista, Windows XP SP2, Windows Server 2003
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0
另请参见
参考
System.Windows.Ink.AnalysisCore 命名空间
InkAnalyzerBase.ClearStrokeData