Поделиться через


ImageNode - класс

Обновлен: Ноябрь 2007

Represents a ContextNode for a two-dimensional region where any non-ink images may exist in the application.

Пространство имен:  Microsoft.Ink
Сборка:  Microsoft.Ink.Analysis (в Microsoft.Ink.Analysis.dll)

Синтаксис

'Декларация
Public NotInheritable Class ImageNode _
    Inherits ContextNode
'Применение
Dim instance As ImageNode
public sealed class ImageNode : ContextNode
public ref class ImageNode sealed : public ContextNode
public final class ImageNode extends ContextNode
public final class ImageNode extends ContextNode

Заметки

The InkAnalyzer does not produce ImageNode objects. The application uses the ContextNode.CreateSubNode method to add the ImageNode objects to the context node tree. If the state of the analyzer is persisted, these nodes can be persisted as well.

Future recognizers may use the regions defined by the ImageNode objects to determine if any ink annotates the non-ink image.

An ImageNode cannot have any children.

Примеры

The following example adds an ImageNode object to an InkAnalyzer, theInkAnalyzer, for a PictureBox control, thePictureBox. It converts the location of the PictureBox control from pixel coordinates to ink coordinates. It sets the Data property of the ImageNode object to be the Image property of the 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();
}

Иерархия наследования

System.Object
  Microsoft.Ink.ContextNode
    Microsoft.Ink.ImageNode

Потокобезопасность

Любые открытые члены этого типа, объявленные как static (Shared в Visual Basic), являются потокобезопасными. Потокобезопасность членов экземпляров не гарантируется.

Платформы

Windows Vista

Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.

Сведения о версии

.NET Framework

Поддерживается в версии: 3.0

См. также

Ссылки

ImageNode - члены

Microsoft.Ink - пространство имен

Microsoft.Ink.TextWordNode