ContextNodeTypeBase 类
定义用于指定 ContextNode 对象的类型的值。
命名空间: System.Windows.Ink.AnalysisCore
程序集: IACore(在 IACore.dll 中)
语法
声明
Public NotInheritable Class ContextNodeTypeBase
用法
Dim instance As ContextNodeTypeBase
public sealed class ContextNodeTypeBase
public ref class ContextNodeTypeBase sealed
public final class ContextNodeTypeBase
public final class ContextNodeTypeBase
备注
ContextNodeBase.Type 属性和 InkAnalyzerBase.FindNodesOfType 方法经常使用此类的字段。
示例
此示例设置 TextBox (selectedResultsTextBox) 的 Text 属性,从而为 ContextNodeBase (selectedNode) 显示合适的字符串。该示例使用 Type 属性根据 ContextNodeBase 的类型选择要显示的文本的种类。
If (selectedNode.ContainsPropertyData(PropertyGuidsForContextNodesBase.RecognizedString) AndAlso _
(selectedNode.Type = System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.WritingRegion OrElse _
selectedNode.Type = System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Paragraph OrElse _
selectedNode.Type = System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.CustomRecognizer OrElse _
selectedNode.Type = System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Object OrElse _
selectedNode.Type = System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line)) Then
selectedResultsTextBox.Text = _
CType(selectedNode.GetPropertyData(PropertyGuidsForContextNodesBase.RecognizedString), String)
ElseIf (selectedNode.Type = System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.InkWord) Then
Dim parentNode As ContextNodeBase = selectedNode.ParentNode
If (parentNode.Type = System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line AndAlso _
parentNode.ContainsPropertyData(PropertyGuidsForContextNodesBase.RecognizedString)) Then
' Put parent line's recognized string into the text box
selectedResultsTextBox.Text = _
CType(parentNode.GetPropertyData(PropertyGuidsForContextNodesBase.RecognizedString), String)
' Select the text that corresponds to the ink word
Dim subNodes As New ContextNodeBaseCollection(theInkAnalyzerBase)
subNodes.Add(selectedNode)
Dim start As Integer
Dim length As Integer
theInkAnalyzerBase.GetTextRangeFromNodes(subNodes, start, length)
If (start >= 0 AndAlso length > 0) Then
selectedResultsTextBox.Select(start, length)
End If
End If
ElseIf (selectedNode.Type = System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.InkDrawing AndAlso _
selectedNode.ContainsPropertyData(PropertyGuidsForContextNodesBase.ShapeName)) Then
selectedResultsTextBox.Text = _
CType(selectedNode.GetPropertyData(PropertyGuidsForContextNodesBase.ShapeName), String)
End If
if (selectedNode.ContainsPropertyData(PropertyGuidsForContextNodesBase.RecognizedString) &&
(selectedNode.Type == System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.WritingRegion ||
selectedNode.Type == System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Paragraph ||
selectedNode.Type == System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.CustomRecognizer ||
selectedNode.Type == System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Object ||
selectedNode.Type == System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line))
{
selectedResultsTextBox.Text =
(string)selectedNode.GetPropertyData(PropertyGuidsForContextNodesBase.RecognizedString);
}
else if (selectedNode.Type == System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.InkWord)
{
ContextNodeBase parentNode = selectedNode.ParentNode;
if (parentNode.Type == System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line &&
parentNode.ContainsPropertyData(PropertyGuidsForContextNodesBase.RecognizedString))
{
// Put parent line's recognized string into the text box
selectedResultsTextBox.Text =
(string)parentNode.GetPropertyData(PropertyGuidsForContextNodesBase.RecognizedString);
// Select the text that corresponds to the ink word
ContextNodeBaseCollection subNodes = new ContextNodeBaseCollection(theInkAnalyzerBase);
subNodes.Add(selectedNode);
int start;
int length;
theInkAnalyzerBase.GetTextRangeFromNodes(subNodes, out start, out length);
if (start >= 0 && length > 0)
{
selectedResultsTextBox.Select(start, length);
}
}
}
else if (selectedNode.Type == System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.InkDrawing &&
selectedNode.ContainsPropertyData(PropertyGuidsForContextNodesBase.ShapeName))
{
selectedResultsTextBox.Text =
(string)selectedNode.GetPropertyData(PropertyGuidsForContextNodesBase.ShapeName);
}
继承层次结构
System.Object
System.Windows.Ink.AnalysisCore.ContextNodeTypeBase
线程安全
此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。
平台
Windows Vista, Windows XP SP2, Windows Server 2003
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0