/// <summary>
        /// Sets the annotation comment location.
        /// </summary>
        /// <param name="comment">The comment.</param>
        private void SetAnnotationCommentLocation(AnnotationComment comment)
        {
            VintasoftImage focusedImage = _annotationVisualTool.ImageViewer.Image;

            if (focusedImage != null)
            {
                float x = (float)UnitOfMeasureConverter.ConvertToDeviceIndependentPixels(focusedImage.Width, UnitOfMeasure.Pixels, focusedImage.Resolution.Horizontal);
                comment.BoundingBox = new RectangleF(
                    x, comment.Annotation.Location.Y,
                    AnnotationComment.DefaultCommentSize.Width, AnnotationComment.DefaultCommentSize.Height);
            }
        }
        /// <summary>
        /// Adds the comment to the specified annotation data.
        /// </summary>
        /// <param name="data">The annotation data.</param>
        /// <returns>
        /// The comment.
        /// </returns>
        public AnnotationComment AddCommentToAnnotation(AnnotationData data)
        {
            if (data == null)
            {
                return(null);
            }

            // save reference to the previous comment
            AnnotationComment comment = data.Comment;

            // if annotation comment does not exist
            if (comment == null)
            {
                // create comment
                comment      = new AnnotationComment(Color.Yellow, Environment.UserName);
                comment.Type = AnnotationCommentTypeFactory.GetCommentType(data);

                // add comment to the annotation
                data.Comment = comment;
            }

            // set comment location
            SetAnnotationCommentLocation(comment);

            // open comment
            comment.IsOpen = true;

            // if comment is not selected
            if (_commentVisualTool != null &&
                (_commentVisualTool.SelectedComment == null ||
                 _commentVisualTool.SelectedComment.Comment != comment))
            {
                _commentVisualTool.SelectedComment = _commentVisualTool.FindCommentControl(comment);
            }

            return(comment);
        }
Ejemplo n.º 3
0
            // Constructs pair of class member declaration and defining declaration for a skeleton method
#pragma warning disable S1172 // Unused method parameters should be removed -> False-positive, the parameters are used
            static (ClassMemberDeclaration, MethodDeclaration) declareMethod(Visibility visibility, MethodInterfaceDeclaration.Types.Binding binding, MethodDeclaration definingDeclaration, AnnotationComment comment) => (