TextWordNode.SetLocation-Methode
Legt die Position des Nicht-Freihandworts im Anwendungsdokument fest.
Namespace: Microsoft.Ink
Assembly: Microsoft.Ink.Analysis (in Microsoft.Ink.Analysis.dll)
Syntax
'Declaration
Public Sub SetLocation ( _
location As AnalysisRegion _
)
'Usage
Dim instance As TextWordNode
Dim location As AnalysisRegion
instance.SetLocation(location)
public void SetLocation(
AnalysisRegion location
)
public:
void SetLocation(
AnalysisRegion^ location
)
public void SetLocation(
AnalysisRegion location
)
public function SetLocation(
location : AnalysisRegion
)
Parameter
- location
Typ: Microsoft.Ink.AnalysisRegion
Die Position in Freihandkoordinaten des Nicht-Freihandworts im Anwendungsdokument.
Hinweise
Die Position wird in Freihandkoordinaten festgelegt.
Beispiele
Im folgenden Beispiel wird ein TextWordNode-Objekt einem InkAnalyzer (theInkAnalyzer) für ein Text-Steuerelement (theTextBox) hinzugefügt. Die Position des Text-Steuerelements wird von Pixelkoordinaten in Freihandkoordinaten konvertiert. Die Data-Eigenschaft des TextWordNode-Objekts wird als Text-Eigenschaft des Text-Steuerelements festgelegt.
' Add nodes to hold the TextWordNode
Dim writingRegion As WritingRegionNode = _
theInkAnalyzer.RootNode.CreateSubNode(Microsoft.Ink.ContextNodeType.WritingRegion)
Dim paragraph As ParagraphNode = _
writingRegion.CreateSubNode(Microsoft.Ink.ContextNodeType.Paragraph)
Dim Line As LineNode = _
paragraph.CreateSubNode(Microsoft.Ink.ContextNodeType.Line)
' Convert pixel coordinates to pixel coordinates and have the TextWordNode
' be for the entire TextBox
Dim topLeft As Point = theTextBox.Location
Dim bottomRight As New Point(theTextBox.Right, theTextBox.Bottom)
Dim thePanelGraphics As Graphics = theNotesPanel.CreateGraphics()
theInkCollector.Renderer.PixelToInkSpace(thePanelGraphics, topLeft)
theInkCollector.Renderer.PixelToInkSpace(thePanelGraphics, bottomRight)
thePanelGraphics.Dispose()
' Create node for the word
Dim textWord As TextWordNode = _
Line.CreateSubNode(Microsoft.Ink.ContextNodeType.TextWord)
' Set location
Dim rectLocation As New Rectangle(topLeft, _
New Size(bottomRight.X - topLeft.X, bottomRight.Y - topLeft.Y))
textWord.SetLocation(New AnalysisRegion(rectLocation))
' Set the data property to be the text in the textbox.
textWord.Data = theTextBox.Text
// Add nodes to hold the TextWordNode
WritingRegionNode writingRegion = (WritingRegionNode)
theInkAnalyzer.RootNode.CreateSubNode(Microsoft.Ink.ContextNodeType.WritingRegion);
ParagraphNode paragraph = (ParagraphNode)
writingRegion.CreateSubNode(Microsoft.Ink.ContextNodeType.Paragraph);
LineNode line = (LineNode)
paragraph.CreateSubNode(Microsoft.Ink.ContextNodeType.Line);
// Convert pixel coordinates to pixel coordinates and have the TextWordNode
// be for the entire TextBox
Point topLeft = theTextBox.Location;
Point bottomRight = new Point(theTextBox.Right,
theTextBox.Bottom);
Graphics thePanelGraphics = theNotesPanel.CreateGraphics();
theInkCollector.Renderer.PixelToInkSpace(thePanelGraphics, ref topLeft);
theInkCollector.Renderer.PixelToInkSpace(thePanelGraphics, ref bottomRight);
thePanelGraphics.Dispose();
// Create node for the word
TextWordNode textWord = (TextWordNode)
line.CreateSubNode(Microsoft.Ink.ContextNodeType.TextWord);
// Set location
Rectangle rectLocation = new Rectangle(topLeft,
new Size(bottomRight.X - topLeft.X, bottomRight.Y - topLeft.Y));
textWord.SetLocation(new AnalysisRegion(rectLocation));
// Set the data property to be the text in the textbox.
textWord.Data = theTextBox.Text;
Plattformen
Windows Vista
.NET Framework und .NET Compact Framework unterstützen nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen für .NET Framework.
Versionsinformationen
.NET Framework
Unterstützt in: 3.0