Home : DotImage : Add StartCap and EndCap to change the look of a Line annotation
Q10386 - HOWTO: Add StartCap and EndCap to change the look of a Line annotation

People often want to use a LineAnnotation as a pointer - to draw an arrow-type shape.

However, you'll quickly discover that the LineData object used to create a LineAnnotation has no "pointer" or "EndCap" property. Never fear... the EndCap and StartCap is there, but you need to know where to look.

StartCap and EndCap are actually properties of an AnnotationPen which is used to describe the Outline of the LineData (which itself is the data object used to make a LineAnnotation).

 Putting this altogether:

LineData lineData = new LineData(); 
lineData.Name = "DefaultLine"; 
AnnotationPen myOutliner = new AnnotationPen(System.Drawing.Color.Black, 2); 
myOutliner.EndCap = new AnnotationLineCap(AnnotationLineCapStyle.Diamond, new SizeF(10f, 10f)); 
myOutliner.StartCap = new AnnotationLineCap(AnnotationLineCapStyle.Arrow, new SizeF(10f, 10f)); 
lineData.Outline = myOutliner;

You can now add lineData to your WebAnnotationViewer's DefaultAnnotations collection or as part of a LineAnnotation you're going to add to a winforms AnnotateViewer.


NOTE: This article references the legacy WebAnnotationViewer control.. that is a legacy control which is eventually to be deprecated and removed. The WebDocumentViewer control also supports end can and start caps though the implementation is slightly different. If you have questions about start/end caps on line annotations in WebDocumentViewer, please create a support case and we can assist you

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?


Tell us why you rated the content this way. (optional)
Approved Comments...
No user comments available for this article.

Powered By InstantKB.NET v1.3
Copyright © 2002, 2020. InstantASP Ltd. All Rights Reserved