ImageGear for .NET
Annotator

The main piece of the WPF annotations UI is implemented in the Annotator Class. Use this class in your application to enable interactions with the annotations loaded by ImageGear. This will allow you to create annotation marks with or without a toolbar; edit, move, resize, or delete annotations; and view and edit their properties. The Annotator is associated with the PageView Class control during the initialization. A reference to the associated PageView Class control is available via the Annotator.PageView Property. The following code demonstrates initialization of the Annotator: 

C#
Copy Code
 Annotator m_Annotator;
 m_Annotator = new Annotator(m_igPageView);

The Annotator is applicable to the same image and the annotation page used by the PageView Class. The image page is accessible via the PageView.Display Property.Page Property. The annotation page is accessible via the PageView.Display Property.ARTPage Property.

In order to display an image in your PageView Class control you would load or create an ImGearPage Class object using the ImageGear API and set it to the PageView.Display Property.Page Property. A similar approach can be used for annotations - load or create an ImGearARTPage Class object using the ImageGear.ART Namespace API and set it to the PageView.Display Property.ARTPage Property. The following code demonstrates PageView.Display Property initialization with the new image and annotation pages:

C#
Copy Code
 ImGearPage m_CurrentPage;
 ImGearARTPage m_CurrentArtPage;
 m_CurrentPage = ImGearFileFormats.LoadPage(f, 0);
 m_CurrentArtPage = ImGearART.LoadPage(page);
 if (m_CurrentArtPage == null)
 {
  m_CurrentArtPage = new ImGearARTPage();
 }
 m_igPageView.Display = new ImGearPresentationPageDisplay(m_ CurrentPage, m_CurrentArtPage);

In order to enable the Annotator support, you just need to initialize the Annotator Class as demonstrated in the code example above.

The Annotator Class provides a set of events that allow you to control the process of creating, editing, and deleting marks using the UI. The following code demonstrates initialization and use of the Annotator Class events:

C#
Copy Code
m_Annotator.PreCreateMark += new Annotator.PreCreateMarkEventHandler(Page_PreCreateMark);
m_Annotator.PreDeleteMark += new Annotator.PreDeleteMarkEventHandler(Page_PreDeleteMark);
m_Annotator.ModifyMark += new Annotator.ModifyMarkEventHandler(Page_ModifyMark);
 public void Page_PreCreateMark(object sender, PreCreateMarkEventArgs e)
 {
  // Check the mark.
 }
 public void Page_PreDeleteMark(object sender, PreDeleteMarkEventArgs e)
 {
  // Check the mark.
 }
 public void Page_ModifyMark(object sender, ModifyMarkEventArgs e)
 {
  // Check the modified mark.
 }

 

 


©2015. Accusoft Corporation. All Rights Reserved.

Send Feedback