ImageNode.SetLocation (Método)
Actualización: noviembre 2007
Establece la ubicación de la imagen no manuscrita en el documento de la aplicación.
Espacio de nombres: Microsoft.Ink
Ensamblado: Microsoft.Ink.Analysis (en Microsoft.Ink.Analysis.dll)
Sintaxis
'Declaración
Public Sub SetLocation ( _
location As AnalysisRegion _
)
'Uso
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
)
Parámetros
- location
Tipo: Microsoft.Ink.AnalysisRegion
La ubicación en la que se encuentra la imagen no manuscrita en el documento de la aplicación, en coordenadas de entrada manuscrita.
Comentarios
La ubicación se establece en coordenadas de entrada manuscrita.
Ejemplos
En el ejemplo siguiente se agrega un objeto ImageNode a un objeto InkAnalyzer, theInkAnalyzer, de un control PictureBox, thePictureBox. Convierte la ubicación del control PictureBox de coordenadas en píxeles a coordenadas de entrada manuscrita. Establece la propiedad Data del objeto ImageNode para que sea la propiedad Image del control PictureBox.
' Add image node
Dim pictureNode As ImageNode = _
theInkAnalyzer.RootNode.CreateSubNode(Microsoft.Ink.ContextNodeType.Image)
' Convert pixel coordinates to pixel coordinates
Dim pictureTopLeft As Point = thePictureBox.Location
Dim pictureBottomRight As New Point(thePictureBox.Right, thePictureBox.Bottom)
Dim panelGraphics As Graphics = theNotesPanel.CreateGraphics()
theInkCollector.Renderer.PixelToInkSpace(panelGraphics, pictureTopLeft)
theInkCollector.Renderer.PixelToInkSpace(panelGraphics, pictureBottomRight)
panelGraphics.Dispose()
' Set the location of the image node
pictureNode.SetLocation(New AnalysisRegion(New Rectangle(pictureTopLeft.X, _
pictureTopLeft.Y, pictureBottomRight.X - pictureTopLeft.X, _
pictureBottomRight.Y - pictureTopLeft.Y)))
' Serialize the image to a byte array and set ImageNode.Data to the array.
Using stream As System.IO.MemoryStream = New System.IO.MemoryStream()
thePictureBox.Image.Save(stream, thePictureBox.Image.RawFormat)
pictureNode.Data = stream.ToArray()
End Using
// Add image node
ImageNode pictureNode = (ImageNode)
theInkAnalyzer.RootNode.CreateSubNode(Microsoft.Ink.ContextNodeType.Image);
// Convert pixel coordinates to pixel coordinates
Point pictureTopLeft = thePictureBox.Location;
Point pictureBottomRight = new Point(thePictureBox.Right,
thePictureBox.Bottom);
Graphics panelGraphics = theNotesPanel.CreateGraphics();
theInkCollector.Renderer.PixelToInkSpace(panelGraphics, ref pictureTopLeft);
theInkCollector.Renderer.PixelToInkSpace(panelGraphics, ref pictureBottomRight);
panelGraphics.Dispose();
// Set the location of the image node
pictureNode.SetLocation(new AnalysisRegion(new Rectangle(pictureTopLeft.X,
pictureTopLeft.Y, pictureBottomRight.X - pictureTopLeft.X,
pictureBottomRight.Y - pictureTopLeft.Y)));
// Serialize the image to a byte array and set ImageNode.Data to the array.
using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
{
thePictureBox.Image.Save(stream, thePictureBox.Image.RawFormat);
pictureNode.Data = stream.ToArray();
}
Plataformas
Windows Vista
.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.
Información de versión
.NET Framework
Compatible con: 3.0