Export (0) Print
Expand All

ImageNode Class

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

Namespace:  System.Windows.Ink
Assembly:  IAWinFX (in IAWinFX.dll)

public sealed class ImageNode : ContextNode

The InkAnalyzer does not produce ImageNode objects. The application uses the CreateSubNode(ContextNodeType) 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 to an InkAnalyzer, theInkAnalyzer, for an Image named theImage. It sets the location of the ImageNode to the location of the Image and the Data property to the Source property of the Image.

// Add image node
ImageNode pictureNode = (ImageNode)

// 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();
using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
    pictureNode.Data = stream.ToArray();

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.0

Community Additions

© 2015 Microsoft