ImageNode.SetLocation, méthode
Mise à jour : November 2007
Définit l'emplacement de l'image non manuscrite sur le document d'application.
Espace de noms : System.Windows.Ink
Assembly : IAWinFX (dans IAWinFX.dll)
Syntaxe
'Déclaration
Public Sub SetLocation ( _
location As AnalysisRegion _
)
'Utilisation
Dim instance As ImageNode
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 : System.Windows.Ink.AnalysisRegion
Notes
L'emplacement est défini dans les coordonnées d'entrée manuscrite.
Exemples
L'exemple suivant ajoute un ImageNode à un InkAnalyzer, theInkAnalyzer, pour une Image appelée theImage. L'emplacement de ImageNode a la valeur de l'emplacement de Image et la propriété Data a la valeur de la propriété Source de Image.
' Add image node
Dim pictureNode As ImageNode = _
CType(theInkAnalyzer.RootNode.CreateSubNode(ContextNodeType.Image), _
ImageNode)
' Set the location of the image node
Dim imageTop As Double = InkCanvas.GetTop(theImage)
Dim imageLeft As Double = InkCanvas.GetLeft(theImage)
Dim imageBounds As New Rect(imageLeft, imageTop, theImage.Width, theImage.Height)
pictureNode.SetLocation(New AnalysisRegion(imageBounds))
' Serialize the image to a byte array and set ImageNode.Data to the array.
' theImage.Source is a BitmapImage.
Dim bmp As New BmpBitmapEncoder()
bmp.Frames.Add(BitmapFrame.Create(CType(theImage.Source, BitmapImage)))
Dim stream As New System.IO.MemoryStream()
Try
bmp.Save(stream)
pictureNode.Data = stream.ToArray()
Finally
stream.Dispose()
End Try
// Add image node
ImageNode pictureNode = (ImageNode)
theInkAnalyzer.RootNode.CreateSubNode(ContextNodeType.Image);
// Set the location of the image node
double imageTop = InkCanvas.GetTop(theImage);
double imageLeft = InkCanvas.GetLeft(theImage);
Rect imageBounds = new Rect(imageLeft, imageTop, theImage.Width, theImage.Height);
pictureNode.SetLocation(new AnalysisRegion(imageBounds));
// Serialize the image to a byte array and set ImageNode.Data to the array.
// theImage.Source is a BitmapImage.
BmpBitmapEncoder bmp = new BmpBitmapEncoder();
bmp.Frames.Add(BitmapFrame.Create((BitmapImage)theImage.Source));
using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
{
bmp.Save(stream);
pictureNode.Data = stream.ToArray();
}
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