public void Add(Annotation annotation) { DrawingAnnotation drawingAnn = null; foreach (var prototype in prototypes) { if (prototype.BelongsTo(annotation.Polygon)) { drawingAnn = (DrawingAnnotation)Activator.CreateInstance(prototype.GetType()); drawingAnn.Initialize(pictureBox); drawingAnn.Annotation = annotation; drawingAnn.IsSelected = false; drawingAnn.ShowLabel = this.ShowLabels; break; } } if (drawingAnn == null) { throw new Exception("Could not determine the drawing annotation type!"); } drawingAnnotations.Add(drawingAnn); }
void drawingManager_OnElementSelected(DrawingManager sender, DrawingAnnotation element) { this.txtAnnotationLabel.Text = element.Annotation.Label; }