VintaSoft Imaging .NET SDK 12.4: Documentation for .NET developer
Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools Namespace / WpfCommentVisualTool Class
Members Object Syntax Example Hierarchy Requirements SeeAlso
In This Topic
    WpfCommentVisualTool Class
    In This Topic
    Represents a visual tool that allows to comment images in WPF image viewer.
    Object Model
    WpfImageViewerCommentController ICommentControl WpfImageViewer WpfCommentVisualTool
    Syntax
    'Declaration
    
    <DesignTimeVisibleAttribute("Visible = False")>
    <ToolboxItemAttribute("ToolboxItemType = null", "ToolboxItemTypeName = ")>
    <DefaultPropertyAttribute("Content")>
    <ContentPropertyAttribute("Content")>
    <LocalizabilityAttribute(None)>
    <StyleTypedPropertyAttribute("Property = FocusVisualStyle", "StyleTargetType = System.Windows.Controls.Control")>
    <XmlLangPropertyAttribute("Name = Language")>
    <UsableDuringInitializationAttribute("Usable = True")>
    <RuntimeNamePropertyAttribute("Name = Name")>
    <UidPropertyAttribute()>
    <TypeDescriptionProviderAttribute("TypeName = MS.Internal.ComponentModel.DependencyObjectProvider")>
    <NameScopePropertyAttribute("Name = NameScope", "Type = System.Windows.NameScope")>
    Public Class WpfCommentVisualTool
       Inherits Vintasoft.Imaging.Wpf.UI.VisualTools.WpfVisualTool
    
    
    [DesignTimeVisible("Visible = False")]
    [ToolboxItem("ToolboxItemType = null", "ToolboxItemTypeName = ")]
    [DefaultProperty("Content")]
    [ContentProperty("Content")]
    [Localizability(None)]
    [StyleTypedProperty("Property = FocusVisualStyle", "StyleTargetType = System.Windows.Controls.Control")]
    [XmlLangProperty("Name = Language")]
    [UsableDuringInitialization("Usable = True")]
    [RuntimeNameProperty("Name = Name")]
    [UidProperty()]
    [TypeDescriptionProvider("TypeName = MS.Internal.ComponentModel.DependencyObjectProvider")]
    [NameScopeProperty("Name = NameScope", "Type = System.Windows.NameScope")]
    public class WpfCommentVisualTool : Vintasoft.Imaging.Wpf.UI.VisualTools.WpfVisualTool
    
    
    [DesignTimeVisible("Visible = False")]
    [ToolboxItem("ToolboxItemType = null", "ToolboxItemTypeName = ")]
    [DefaultProperty("Content")]
    [ContentProperty("Content")]
    [Localizability(None)]
    [StyleTypedProperty("Property = FocusVisualStyle", "StyleTargetType = System.Windows.Controls.Control")]
    [XmlLangProperty("Name = Language")]
    [UsableDuringInitialization("Usable = True")]
    [RuntimeNameProperty("Name = Name")]
    [UidProperty()]
    [TypeDescriptionProvider("TypeName = MS.Internal.ComponentModel.DependencyObjectProvider")]
    [NameScopeProperty("Name = NameScope", "Type = System.Windows.NameScope")]
    public __gc class WpfCommentVisualTool : public Vintasoft.Imaging.Wpf.UI.VisualTools.WpfVisualTool*
    
    
    [DesignTimeVisible("Visible = False")]
    [ToolboxItem("ToolboxItemType = null", "ToolboxItemTypeName = ")]
    [DefaultProperty("Content")]
    [ContentProperty("Content")]
    [Localizability(None)]
    [StyleTypedProperty("Property = FocusVisualStyle", "StyleTargetType = System.Windows.Controls.Control")]
    [XmlLangProperty("Name = Language")]
    [UsableDuringInitialization("Usable = True")]
    [RuntimeNameProperty("Name = Name")]
    [UidProperty()]
    [TypeDescriptionProvider("TypeName = MS.Internal.ComponentModel.DependencyObjectProvider")]
    [NameScopeProperty("Name = NameScope", "Type = System.Windows.NameScope")]
    public ref class WpfCommentVisualTool : public Vintasoft.Imaging.Wpf.UI.VisualTools.WpfVisualTool^
    
    
    Example

    This C#/VB.NET code shows how to initialize WPF image viewer for displaying the annotation comments.

    
    ''' <summary>
    ''' Initializes WPF image viewer for displaying PDF annotation comments.
    ''' </summary>
    ''' <param name="imageViewer">WPF image viewer, which must be initialized for displaying PDF annotation comments.</param>
    Public Shared Sub InitViewerToDisplayPdfAnnotationComments(imageViewer As Vintasoft.Imaging.Wpf.UI.WpfImageViewer)
        ' create new PDF annotation comment controller
        Dim annotationCommentController As New Vintasoft.Imaging.Annotation.Comments.Pdf.ImageCollectionPdfAnnotationCommentController()
        ' create the comment visual tool, which is associated with PDF annotation comment controller
        Dim commentVisualTool As Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.WpfCommentVisualTool = CreateCommentTool(annotationCommentController)
        ' specify that comment visual tool must be used in WPF image viewer
        imageViewer.VisualTool = New Vintasoft.Imaging.Wpf.UI.VisualTools.WpfCompositeVisualTool(commentVisualTool, imageViewer.VisualTool)
    End Sub
    
    ''' <summary>
    ''' Initializes WPF annotation viewer for displaying Vintasoft annotation comments.
    ''' </summary>
    ''' <param name="annotationViewer">WPF annotation viewer, which must be initialized for displaying Vintasoft annotation comments.</param>
    Public Shared Sub InitViewerToDisplayVintasoftAnnotationComments(annotationViewer As Vintasoft.Imaging.Annotation.Wpf.UI.WpfAnnotationViewer)
        ' create the annotation comment controller, which is associated with annotation data controller
        Dim annotationCommentController As New Vintasoft.Imaging.Annotation.Comments.AnnotationCommentController(annotationViewer.AnnotationDataController)
        ' create the comment visual tool, which is associated with annotation comment controller
        Dim commentVisualTool As Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.WpfCommentVisualTool = CreateCommentTool(annotationCommentController)
        ' specify that comment visual tool must be used in WinForms annotation viewer
        annotationViewer.VisualTool = New Vintasoft.Imaging.Wpf.UI.VisualTools.WpfCompositeVisualTool(commentVisualTool, annotationViewer.VisualTool)
    End Sub
    
    ''' <summary>
    ''' Creates the comment visual tool using the specified comment controller.
    ''' </summary>
    ''' <param name="imageCollectionCommentController">The image collection comment controller.</param>
    ''' <returns>The comment visual tool.</returns>
    Public Shared Function CreateCommentTool(imageCollectionCommentController As Vintasoft.Imaging.Annotation.Comments.ImageCollectionCommentController) As Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.WpfCommentVisualTool
        ' create the comment controller for WPF image viewer
        Dim commentController As New Vintasoft.Imaging.Annotation.Wpf.UI.Comments.WpfImageViewerCommentController(imageCollectionCommentController)
        ' create the comment visual tool, which uses the CommentControlFactory class for creating the comment controls
        Return New Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.WpfCommentVisualTool(commentController, New CommentControlFactory())
    End Function
    
    
    
    ''' <summary>
    ''' Represents a factory that allows to create comment controls.
    ''' </summary>
    Public Class CommentControlFactory
        Implements Vintasoft.Imaging.Annotation.UI.Comments.ICommentControlFactory
    
        ''' <summary>
        ''' Creates the comment control that displays specified comment.
        ''' </summary>
        ''' <param name="comment">The comment.</param>
        ''' <returns>Comment control that displays specified comment.</returns>
        Public Function Create(comment As Vintasoft.Imaging.Annotation.Comments.Comment) As Vintasoft.Imaging.Annotation.UI.Comments.ICommentControl Implements Vintasoft.Imaging.Annotation.UI.Comments.ICommentControlFactory.Create
            ' create a comment control that displays comment in WPF image viewer
            Return New CommentControl(comment)
        End Function
    
    End Class
    
    
    
    ' see code of CommentControl class for PDF annotation comment in file
    ' "%INSTALL_PATH%\Examples\WPF\CSharp\WpfPdfEditorDemo\DemosCommonCode.Annotation\Comments\CommentControl.xaml"
    '
    ' see code of CommentControl class for Vintasoft annotation comment in file
    ' "%INSTALL_PATH%\Examples\WPF\CSharp\WpfAnnotationDemo\DemosCommonCode.Annotation\Comments\CommentControl.xaml"
    
    
    
    /// <summary>
    /// Initializes WPF image viewer for displaying PDF annotation comments.
    /// </summary>
    /// <param name="imageViewer">WPF image viewer, which must be initialized for displaying PDF annotation comments.</param>
    public static void InitViewerToDisplayPdfAnnotationComments(Vintasoft.Imaging.Wpf.UI.WpfImageViewer imageViewer)
    {
        // create new PDF annotation comment controller
        Vintasoft.Imaging.Annotation.Comments.Pdf.ImageCollectionPdfAnnotationCommentController annotationCommentController =
            new Vintasoft.Imaging.Annotation.Comments.Pdf.ImageCollectionPdfAnnotationCommentController();
        // create the comment visual tool, which is associated with PDF annotation comment controller
        Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.WpfCommentVisualTool commentVisualTool = CreateCommentTool(annotationCommentController);
        // specify that comment visual tool must be used in WPF image viewer
        imageViewer.VisualTool = new Vintasoft.Imaging.Wpf.UI.VisualTools.WpfCompositeVisualTool(commentVisualTool, imageViewer.VisualTool);
    }
    
    /// <summary>
    /// Initializes WPF annotation viewer for displaying Vintasoft annotation comments.
    /// </summary>
    /// <param name="annotationViewer">WPF annotation viewer, which must be initialized for displaying Vintasoft annotation comments.</param>
    public static void InitViewerToDisplayVintasoftAnnotationComments(Vintasoft.Imaging.Annotation.Wpf.UI.WpfAnnotationViewer annotationViewer)
    {
        // create the annotation comment controller, which is associated with annotation data controller
        Vintasoft.Imaging.Annotation.Comments.AnnotationCommentController annotationCommentController =
            new Vintasoft.Imaging.Annotation.Comments.AnnotationCommentController(annotationViewer.AnnotationDataController);
        // create the comment visual tool, which is associated with annotation comment controller
        Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.WpfCommentVisualTool commentVisualTool = CreateCommentTool(annotationCommentController);
        // specify that comment visual tool must be used in WinForms annotation viewer
        annotationViewer.VisualTool = new Vintasoft.Imaging.Wpf.UI.VisualTools.WpfCompositeVisualTool(commentVisualTool, annotationViewer.VisualTool);
    }
    
    /// <summary>
    /// Creates the comment visual tool using the specified comment controller.
    /// </summary>
    /// <param name="imageCollectionCommentController">The image collection comment controller.</param>
    /// <returns>The comment visual tool.</returns>
    public static Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.WpfCommentVisualTool CreateCommentTool(
        Vintasoft.Imaging.Annotation.Comments.ImageCollectionCommentController imageCollectionCommentController)
    {
        // create the comment controller for WPF image viewer
        Vintasoft.Imaging.Annotation.Wpf.UI.Comments.WpfImageViewerCommentController commentController =
            new Vintasoft.Imaging.Annotation.Wpf.UI.Comments.WpfImageViewerCommentController(imageCollectionCommentController);
        // create the comment visual tool, which uses the CommentControlFactory class for creating the comment controls
        return new Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.WpfCommentVisualTool(commentController, new CommentControlFactory());
    }
    
    
    
    /// <summary>
    /// Represents a factory that allows to create comment controls.
    /// </summary>
    public class CommentControlFactory : Vintasoft.Imaging.Annotation.UI.Comments.ICommentControlFactory
    {
    
        /// <summary>
        /// Creates the comment control that displays specified comment.
        /// </summary>
        /// <param name="comment">The comment.</param>
        /// <returns>Comment control that displays specified comment.</returns>
        public Vintasoft.Imaging.Annotation.UI.Comments.ICommentControl Create(Vintasoft.Imaging.Annotation.Comments.Comment comment)
        {
            // create a comment control that displays comment in WPF image viewer
            return new CommentControl(comment);
        }
    
    }
    
    
    
    // see code of CommentControl class for PDF annotation comment in file
    // "%INSTALL_PATH%\Examples\WPF\CSharp\WpfPdfEditorDemo\DemosCommonCode.Annotation\Comments\CommentControl.xaml"
    //
    // see code of CommentControl class for Vintasoft annotation comment in file
    // "%INSTALL_PATH%\Examples\WPF\CSharp\WpfAnnotationDemo\DemosCommonCode.Annotation\Comments\CommentControl.xaml"
    
    

    Inheritance Hierarchy

    System.Object
       System.Windows.Threading.DispatcherObject
          System.Windows.DependencyObject
             System.Windows.Media.Visual
                System.Windows.UIElement
                   System.Windows.FrameworkElement
                      System.Windows.Controls.Control
                         System.Windows.Controls.ContentControl
                            Vintasoft.Imaging.Wpf.UI.VisualTools.WpfVisualTool
                               Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.WpfCommentVisualTool

    Requirements

    Target Platforms: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also