ImageGear .NET - Updated
Custom Mark Class
User Guide > How to Work with... > ART Mark Annotations > Custom Annotations > Custom Mark Class

This abstract class defines a base interface for any user defined custom annotation mark. The user implements a custom mark class by deriving from this base class. Custom mark class resides in the user application, as well as custom mark controller and custom mark annotator controller.

The ImGearARTCustomMark class has a similar public API to what the existing marks have. The only custom mark’s specific property is UserType read-only property of type string. It is used to distinguish marks of different custom types. This property is used by ART to determine which registered type should be used when ART page is loaded. This property should be overridden in users custom mark class. Its value must be unique for each custom mark class implemented in user application.

User Data Attributes

Properties specific to a custom mark are stored in the UserDataAttributes property. UserDataAttributes is a dictionary that contains a set of key/value pairs, both of type string. When a custom mark is loaded, ART loads the UserDataAttributes dictionary first, and then passes it to the user’s code. The user’s code reads and converts custom properties from the UserDataAttributes dictionary in a specific custom mark constructor, which takes UserDataAttributes dictionary as a parameter.

This constructor must be implemented in the user’s custom mark class. The user also has to provide a code (overridden SavePropertiesToUserData method) to save the mark state into the UserDataAttributes when the ART component is about to save/serialize the mark. Constructor’s code and SavePropertiesToUserData must be consistent.