InkWordNode 类
表示构成逻辑分组以形成可识别单词的笔画集合的 ContextNode。
命名空间: Microsoft.Ink
程序集: Microsoft.Ink.Analysis(在 Microsoft.Ink.Analysis.dll 中)
语法
声明
Public NotInheritable Class InkWordNode _
Inherits ContextNode
用法
Dim instance As InkWordNode
public sealed class InkWordNode : ContextNode
public ref class InkWordNode sealed : public ContextNode
public final class InkWordNode extends ContextNode
public final class InkWordNode extends ContextNode
备注
InkWordNode 对象不能包含任何子级。
示例
下面的示例遍历 InkAnalyzer (theInkAnalyzer) 中的所有 InkWordNode 对象,然后绘制显示旋转边框、上行字母线、下行字母线、中线和基线的线条。这些线条在一个 Panel (theNotesPanel) 上绘制。
Dim panelGraphics As Graphics = theNotesPanel.CreateGraphics()
Dim theRenderer As Renderer = theInkCollector.Renderer
' Loop through all of the ink words
Dim inkWords As ContextNodeCollection = _
theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.InkWord)
Dim inkWord As InkWordNode
For Each inkWord In inkWords
' Show rotated bounding box in blue
' Convert corners to pixel coordinates
Dim corners As Point() = inkWord.GetRotatedBoundingBox()
theRenderer.InkSpaceToPixel(panelGraphics, corners)
' Draw the rectangle
panelGraphics.DrawPolygon(New Pen(Color.Blue), corners)
' Show the ascender line in green
Dim ascenderPoints As Point() = inkWord.GetAscender()
' Convert to pixel coordinates
theRenderer.InkSpaceToPixel(panelGraphics, ascenderPoints)
panelGraphics.DrawLines(New Pen(Color.Green), ascenderPoints)
' Show the baseline in purple
Dim basePoints As Point() = inkWord.GetBaseline()
' Convert to pixel coordinates
theRenderer.InkSpaceToPixel(panelGraphics, basePoints)
panelGraphics.DrawLines(New Pen(Color.Purple), basePoints)
' Show the descender line in yellow
Dim descenderPoints As Point() = inkWord.GetDescender()
' Convert to pixel coordinates
theRenderer.InkSpaceToPixel(panelGraphics, descenderPoints)
panelGraphics.DrawLines(New Pen(Color.Yellow), descenderPoints)
' Show the mid line in brown
Dim midlinePoints As Point() = inkWord.GetMidline()
' Convert to pixel coordinates
theRenderer.InkSpaceToPixel(panelGraphics, midlinePoints)
panelGraphics.DrawLines(New Pen(Color.Brown), midlinePoints)
Next inkWord
panelGraphics.Dispose()
End Sub 'inkWordMenuItem_Click
Graphics panelGraphics = theNotesPanel.CreateGraphics();
Renderer theRenderer = theInkCollector.Renderer;
// Loop through all of the ink words
ContextNodeCollection inkWords =
theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.InkWord);
foreach (InkWordNode inkWord in inkWords)
{
// Show rotated bounding box in blue
// Convert corners to pixel coordinates
Point[] corners = inkWord.GetRotatedBoundingBox();
theRenderer.InkSpaceToPixel(panelGraphics, ref corners);
// Draw the rectangle
panelGraphics.DrawPolygon(new Pen(Color.Blue), corners);
// Show the ascender line in green
Point[] ascenderPoints = inkWord.GetAscender();
// Convert to pixel coordinates
theRenderer.InkSpaceToPixel(panelGraphics, ref ascenderPoints);
panelGraphics.DrawLines(new Pen(Color.Green), ascenderPoints);
// Show the baseline in purple
Point[] basePoints = inkWord.GetBaseline();
// Convert to pixel coordinates
theRenderer.InkSpaceToPixel(panelGraphics, ref basePoints);
panelGraphics.DrawLines(new Pen(Color.Purple), basePoints);
// Show the descender line in yellow
Point[] descenderPoints = inkWord.GetDescender();
// Convert to pixel coordinates
theRenderer.InkSpaceToPixel(panelGraphics, ref descenderPoints);
panelGraphics.DrawLines(new Pen(Color.Yellow), descenderPoints);
// Show the mid line in brown
Point[] midlinePoints = inkWord.GetMidline();
// Convert to pixel coordinates
theRenderer.InkSpaceToPixel(panelGraphics, ref midlinePoints);
panelGraphics.DrawLines(new Pen(Color.Brown), midlinePoints);
}
panelGraphics.Dispose();
继承层次结构
System.Object
Microsoft.Ink.ContextNode
Microsoft.Ink.InkWordNode
线程安全
此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0