ImageGear .NET v24.12 - Updated
ImGearAnnotatorRectangleController
User Guide > How to Work with... > Common Operations > Viewing > Viewing with WPF > Controls for XAML Application Development > Annotations > Custom Annotations > ImGearAnnotatorRectangleController

The abstract ImGearAnnotatorRectangleController class derives from ImGearAnnotatorMarkController and can be used as a base class for rectangular marks.

You must override the virtual CreateInProgressMark(ImGearAnnotatorCreateMarkData createMarkData) method to create a mark that is initially set as the PageView in-progress mark. The in-progress mark is the mark that is shown while creating the mark using the mouse, before the mark is added to the ART page. The createMarkData parameter contains data associated with the creation process, such as whether or not the user double-clicked the mouse or any custom data you need to keep track of the state of the creation process.

You can override the virtual DrawInProgressMark(ImGearARTMark mark, IEnumerable<ImGearPoint> points, ImGearAnnotatorCreateMarkData createMarkData) method to modify the in-progress mark while the user is moving or clicking the mouse during the mark creation process. The points parameter contains points indicating the locations in which the user has clicked the mouse.

This class overrides the CanCreateMark(IEnumerable<ImGearPoint> points, ImGearAnnotatorCreateMarkData createMarkData) method so that it returns true if 2 points have been specified. You can override this method to specify when the in-progress mark should be added to the ART page.

By default the virtual CreateMark(ImGearARTMark mark, IEnumerable<ImGearPoint> points, ImGearAnnotatorCreateMarkData createMarkData) method returns the in-progress mark, which is then added to the ART page.

This class overrides the ManageCursor method so that the cursor is changed to the Hand cursor if the mouse is over one of the eight selection handle points in the specified bounds. This class overrides the Resize method to resize the rectangular mark based on the position specified in the point parameter and the ImGearAnnotatorMarkControllerData parameter. This class contains a virtual UpdateBounds(ImGearARTMark mark, IImGearRectangle rect) method which can be used to update the location and size properties of your custom mark by getting those values from the rect parameter. You must override the UpdateBounds method to enable resizing your custom mark.

By default the PageView ShowMarkPropertiesWindow method and ShowMarkPropertiesWindow command will have no effect for a custom mark because the ImGearAnnotatorMarkController ShowPropertiesWindow method returns null. To show a properties window for a custom mark, you will need to override the ShowPropertiesWindow method to return an instance of a class that is derived from IImGearMarkEditorWindow. Information on the custom mark Properties context menu item and other custom mark context menu items can be found in the Context Menu section.