Home : Annotations : 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.

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?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
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, 2017. InstantASP Ltd. All Rights Reserved