Legacy Controls NOTICE
This article references our legacy Web Forms Web Viewing controls (WebImageViewer, WebAnnotationViewer, WebThumbnailViewer). It is preserved for archival purposes, but support strongly recommends using our modern HTML5 web controls: WebDocumentViewer, WebDocumentThumbnailer instead)
http://atalasupport.net/demos/LegacyDemos-11.1/WebViewingDemo.zip
Main Article Content
To create custom annotations in DotImage for use on our WebAnnotationViewer you will need to create a class library in your ASP.NET applications’ solution to contain all of the Atalasoft-overloaded objects that are necessary. To do this:
1. Select your solution in the solution explorer, right-click and select “Add New Item”.
2. Select “Class Library”
Once you have a class library you will need to create an overload of an AnnotationData class. RectangleData is used as a base object for a HiliteData in the following example:
namespace CustomAnnotations
{
public class HiliteData : RectangleData
{
public HiliteData() : base()
{
Fill = new AnnotationBrush(Color.FromArgb(170, Color.Yellow));
this.Outline = new AnnotationPen(Color.Transparent);
}
public HiliteData(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}
Namespace CustomAnnotations
Public Class HiliteData
Inherits RectangleData
Public Sub New()
MyBase.New()
Fill = New AnnotationBrush(Color.FromArgb(170, Color.Yellow))
Me.Outline = New AnnotationPen(Color.Transparent)
End Sub
Public Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext)
MyBase.New(info, context)
End Sub
End Class
End Namespace
The ASP.NET application will then need a reference to the class library. Once it has reference to the library, a static constructor for the page will need to be made. In the static constructor you will need to add to the list of AnnotationRenderers using this method call:
AnnotationRenderers.Add(typeof(HiliteData), new RectangleRenderingEngine());
AnnotationRenderers.Add(GetType(HiliteData), New RectangleRenderingEngine())
The final step is to add the annotation to the viewer on the javascript side:
Javascript