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 物件執行迴圈,然後繪製用以顯示旋轉週框 (Bounding Rectangle)、上緣、下緣、中線和基線的線條。線條是透過在 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
執行緒安全
這個型別的任何 Public static (在 Visual Basic 中為 Shared) 成員都具備執行緒安全。並非所有的執行個體成員都是安全執行緒。
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
版本資訊
.NET Framework
支援版本:3.0