ImageGear for .NET User Guide > Using ImageGear for .NET > Using ImageGear.Windows.Controls Namespace > Annotations > Custom Annotations > ImGearAnnotatorMarkController |
The abstract ImGearAnnotatorMarkController class provides methods that can be overridden to specify the behavior of a custom mark. You can instead derive from the ImGearAnnotatorRectangleController or ImGearAnnotatorPolyController class to inherit rectangular or point-based mark functionality.
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.
You must override the virtual CanCreateMark(IEnumerable<ImGearPoint> points, ImGearAnnotatorCreateMarkData createMarkData) method to specify when the in-progress mark should be added to the ART page. For example, if you want to add your mark when the user double clicks, you can return the value of the createMarkData.IsDoubleClick property.
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.
The virtual ManageCursor(ImGearPoint point, ImGearDoublePoint mousePoint, ImGearAnnotatorMarkControllerData markControllerData) method can be overridden to update the mouse cursor, set an ID for which point of the mark the mouse is currently over, and set the type of resizing to use for that point. The properties of the ImGearAnnotatorMarkControllerData parameter, which include Cursor, PointID, and ResizeType, can be set to update the cursor, etc. The static ImGearAnnotatorMarkController.UpdateCursor method can be used to set the ImGearAnnotatorMarkControllerData.Cursor property to the Hand cursor if the mouse is over the specified point. The virtual Resize(ImGearARTMark mark, ImGearPoint point, ImGearAnnotatorMarkControllerData markControllerData) method can be used to resize the mark.
The ImGearAnnotatorMarkController class also has a virtual GetPropertiesWindow method that can be overridden to return a properties window for a 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.