TextWordNode.SetLocation, méthode
Mise à jour : November 2007
Définit l'emplacement du mot non manuscrit dans le document d'application.
Espace de noms : Microsoft.Ink
Assembly : Microsoft.Ink.Analysis (dans Microsoft.Ink.Analysis.dll)
Syntaxe
'Déclaration
Public Sub SetLocation ( _
location As AnalysisRegion _
)
'Utilisation
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
)
Paramètres
- location
Type : Microsoft.Ink.AnalysisRegion
Emplacement, en coordonnées d'entrée manuscrite, du mot non manuscrit dans le document d'application.
Notes
L'emplacement est défini dans les coordonnées d'entrée manuscrite.
Exemples
L'exemple suivant ajoute un objet TextWordNode à InkAnalyzer, theInkAnalyzer,, pour un contrôle Texte, theTextBox (page pouvant être en anglais). L'emplacement du contrôle Texte (page pouvant être en anglais) est converti de coordonnées en pixels en coordonnées d'entrée manuscrite. La propriété Data de l'objet TextWordNode devient la propriété Text (page pouvant être en anglais) du TextBox (page pouvant être en anglais).
' 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;
Plateformes
Windows Vista
Le .NET Framework et le .NET Compact Framework ne prennent pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.
Informations de version
.NET Framework
Pris en charge dans : 3.0