アプリケーション内でインク以外のイメージが存在可能な 2 次元領域の ContextNode を表します。
名前空間 : System.Windows.Ink
アセンブリ : IAWinFX (IAWinFX.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
解説
InkAnalyzer は ImageNode オブジェクトを生成しません。アプリケーションは、CreateSubNode(ContextNodeType) メソッドを使用して ImageNode オブジェクトをコンテキスト ノード ツリーに追加します。アナライザの状態が保持される場合、これらのノードも同様に保持できます。
将来的には、認識エンジンは ImageNode オブジェクトにより定義された領域を使用して、インク以外のイメージに注釈を作成しているインクがあるかどうかを調べることができます。
ImageNode には子を含めることができません。
例
次の例では、theImage という名前の Image の InkAnalyzer、theInkAnalyzer に ImageNode を追加します。これにより、ImageNode の位置が Image の位置に設定され、Data プロパティが Image の Source プロパティに設定されます。
' 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();
}
継承階層
System.Object
System.Windows.Ink.ContextNode
System.Windows.Ink.ImageNode
スレッド セーフ
この型のすべてのパブリック static (Visual Basic では Shared) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォーム
Windows Vista
.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 3.0