다음을 통해 공유


ImageNode 클래스

업데이트: 2007년 11월

응용 프로그램에서 잉크가 아닌 이미지가 있을 수 있는 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라는 ImageInkAnalyzer인 theInkAnalyzer에 ImageNode를 추가합니다. 그런 다음 ImageNode의 위치를 Image의 위치로 설정하고 Data 속성을 ImageSource 속성으로 설정합니다.

' 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에서 지원

참고 항목

참조

ImageNode 멤버

System.Windows.Ink 네임스페이스

System.Windows.Ink.TextWordNode