public void UpdateAnnotation(AnnotationType type, Atalasoft.Annotate.UI.AnnotationUI annotation) { Atalasoft.Annotate.UI.AnnotationUI newAnn = (Atalasoft.Annotate.UI.AnnotationUI)_table[type]; Type at = newAnn.GetType(); CopyProperty("Fill", at, annotation, newAnn); CopyProperty("Outline", at, annotation, newAnn); CopyProperty("Font", at, annotation, newAnn); CopyProperty("FontBrush", at, annotation, newAnn); if (type != AnnotationType.RubberStamp && type != AnnotationType.StickyNote) { newAnn.Size = SizeF.Empty; } _table[type] = newAnn; }
private void CopyProperty(string propertyName, Type type, Atalasoft.Annotate.UI.AnnotationUI annotation, Atalasoft.Annotate.UI.AnnotationUI newAnnotation) { PropertyInfo info = type.GetProperty(propertyName); if (info == null) { return; } object val = info.GetValue(annotation, null); if (val == null) { return; } Type objType = val.GetType(); MethodInfo cloneMethod = objType.GetMethod("Clone"); info.SetValue(newAnnotation, cloneMethod.Invoke(val, null), null); }
public Atalasoft.Annotate.UI.AnnotationUI GetAnnotation(AnnotationType type) { Atalasoft.Annotate.UI.AnnotationUI ann = ((Atalasoft.Annotate.UI.AnnotationUI)_table[type]).Clone(); ann.Data.Name = type.ToString(); return(ann); }