VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.Annotation.Comments Namespace / AnnotationComment Class
Члены типа Объект Синтаксис Example Иерархия Требования Смотрите также
В этом разделе
    Класс AnnotationComment
    В этом разделе
    Предоставляет комментарий, который сохраняет данные в AnnotationData.
    Объектная модель
    AnnotationData CommentCollection CommentCollection Comment AnnotationComment
    Синтаксис
    'Declaration
    
    <SerializableAttribute()>
    Public Class AnnotationComment
       Inherits Comment
    
    
    [Serializable()]
    public class AnnotationComment : Comment
    
    
    [Serializable()]
    public __gc class AnnotationComment : public Comment*
    
    
    [Serializable()]
    public ref class AnnotationComment : public Comment^
    
    
    Пример

    Вот C#/VB.NET код, который демонстрирует, как печатать комментарии к аннотациям файла TIFF.

    
    ''' <summary>
    ''' Demonstrates how to prints comments of specified TIFF file.
    ''' </summary>
    Public Class AnnotationCommentExample
    
        ''' <summary>
        ''' Prints comments of specified TIFF file.
        ''' </summary>
        ''' <param name="filename">The TIFF filename.</param>
        Public Shared Sub PrintComments(filename As String)
            ' create an image collection
            Using images As New Vintasoft.Imaging.ImageCollection()
                ' add TIFF file to the image collection
                images.Add(filename)
    
                ' create annotation data controller
                Using annotationDataController As New Vintasoft.Imaging.Annotation.AnnotationDataController(images)
                    ' print all comments
                    PrintComments(annotationDataController)
                End Using
    
                ' clear and dispose images
                images.ClearAndDisposeItems()
            End Using
        End Sub
    
        ''' <summary>
        ''' Prints comments from specified annotation data controller.
        ''' </summary>
        ''' <param name="annotationDataController">The annotation data controller.</param>
        Public Shared Sub PrintComments(annotationDataController As Vintasoft.Imaging.Annotation.AnnotationDataControllerBase)
            ' create an annotation comment controller
            Using annotationCommentController As New Vintasoft.Imaging.Annotation.Comments.AnnotationCommentController(annotationDataController)
                ' print all comment of image collection
                PrintComments(annotationCommentController)
            End Using
        End Sub
    
        ''' <summary>
        ''' Prints comments from specified comment controller.
        ''' </summary>
        ''' <param name="commentController">The comment controller.</param>
        Public Shared Sub PrintComments(commentController As Vintasoft.Imaging.Annotation.Comments.ImageCollectionCommentController)
            ' for each image
            For i As Integer = 0 To commentController.Images.Count - 1
                Dim image As Vintasoft.Imaging.VintasoftImage = commentController.Images(i)
    
                ' get comments, which are associated with image
                Dim comments As Vintasoft.Imaging.Annotation.Comments.CommentCollection = commentController.GetComments(image)
                ' if comments are found
                If comments IsNot Nothing AndAlso comments.Count > 0 Then
                    System.Console.WriteLine(String.Format("Page {0}:", i + 1))
    
                    ' for each comment
                    For Each comment As Vintasoft.Imaging.Annotation.Comments.Comment In comments
                        ' print comment
                        PrintComment(comment, 0)
                    Next
                End If
            Next
        End Sub
    
        ''' <summary>
        ''' Prints the comment.
        ''' </summary>
        ''' <param name="comment">The comment.</param>
        ''' <param name="replyLevel">The reply level.</param>
        Private Shared Sub PrintComment(comment As Vintasoft.Imaging.Annotation.Comments.Comment, replyLevel As Integer)
            ' print comment
            System.Console.Write(String.Empty.PadLeft(replyLevel * 4))
            System.Console.WriteLine(String.Format("[{0}] {1}: {2} ({3})", comment.Type, comment.UserName, comment.Text, comment.ModifyDate))
    
            ' if comment has replies
            If comment.Replies IsNot Nothing Then
                ' print replies
                For Each reply As Vintasoft.Imaging.Annotation.Comments.Comment In comment.Replies
                    PrintComment(reply, replyLevel + 1)
                Next
            End If
        End Sub
    
    End Class
    
    
    
    /// <summary>
    /// Demonstrates how to prints comments of specified TIFF file.
    /// </summary>
    public class AnnotationCommentExample
    {
    
        /// <summary>
        /// Prints comments of specified TIFF file.
        /// </summary>
        /// <param name="filename">The TIFF filename.</param>
        public static void PrintComments(string filename)
        {
            // create an image collection
            using (Vintasoft.Imaging.ImageCollection images = new Vintasoft.Imaging.ImageCollection())
            {
                // add TIFF file to the image collection
                images.Add(filename);
    
                // create annotation data controller
                using (Vintasoft.Imaging.Annotation.AnnotationDataController annotationDataController =
                    new Vintasoft.Imaging.Annotation.AnnotationDataController(images))
                {
                    // print all comments
                    PrintComments(annotationDataController);
                }
    
                // clear and dispose images
                images.ClearAndDisposeItems();
            }
        }
    
        /// <summary>
        /// Prints comments from specified annotation data controller.
        /// </summary>
        /// <param name="annotationDataController">The annotation data controller.</param>
        public static void PrintComments(Vintasoft.Imaging.Annotation.AnnotationDataControllerBase annotationDataController)
        {
            // create an annotation comment controller
            using (Vintasoft.Imaging.Annotation.Comments.AnnotationCommentController annotationCommentController =
                new Vintasoft.Imaging.Annotation.Comments.AnnotationCommentController(annotationDataController))
            {
                // print all comment of image collection
                PrintComments(annotationCommentController);
            }
        }
    
        /// <summary>
        /// Prints comments from specified comment controller.
        /// </summary>
        /// <param name="commentController">The comment controller.</param>
        public static void PrintComments(Vintasoft.Imaging.Annotation.Comments.ImageCollectionCommentController commentController)
        {
            // for each image
            for (int i = 0; i < commentController.Images.Count; i++)
            {
                Vintasoft.Imaging.VintasoftImage image = commentController.Images[i];
    
                // get comments, which are associated with image
                Vintasoft.Imaging.Annotation.Comments.CommentCollection comments = commentController.GetComments(image);
                // if comments are found
                if (comments != null && comments.Count > 0)
                {
                    System.Console.WriteLine(string.Format("Page {0}:", i + 1));
    
                    // for each comment
                    foreach (Vintasoft.Imaging.Annotation.Comments.Comment comment in comments)
                    {
                        // print comment
                        PrintComment(comment, 0);
                    }
                }
            }
        }
    
        /// <summary>
        /// Prints the comment.
        /// </summary>
        /// <param name="comment">The comment.</param>
        /// <param name="replyLevel">The reply level.</param>
        private static void PrintComment(Vintasoft.Imaging.Annotation.Comments.Comment comment, int replyLevel)
        {
            // print comment
            System.Console.Write(string.Empty.PadLeft(replyLevel * 4));
            System.Console.WriteLine(string.Format("[{0}] {1}: {2} ({3})", comment.Type, comment.UserName, comment.Text, comment.ModifyDate));
    
            // if comment has replies
            if (comment.Replies != null)
            {
                // print replies
                foreach (Vintasoft.Imaging.Annotation.Comments.Comment reply in comment.Replies)
                    PrintComment(reply, replyLevel + 1);
            }
        }
    
    }
    
    

    Иерархия наследования

    System.Object
       Vintasoft.Imaging.Annotation.Comments.Comment
          Vintasoft.Imaging.Annotation.Comments.AnnotationComment

    Требования

    Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    Смотрите также