VintaSoft Imaging .NET SDK v8.7
Vintasoft.Imaging.Wpf.UI.VisualTools Namespace / WpfTextOverlayTool Class
Members Example



In This Topic
    WpfTextOverlayTool Class
    In This Topic
    A visual tool for displaying static text graphic objects in an image viewer.
    Object Model
    WpfTextOverlayTool ClassIWpfInteractionController InterfaceWpfImageViewer ClassWpfTextOverlayCollection ClassWpfTextOverlay Class
    Syntax
    Example
    This example shows how to show the static text in image viewer.
    ''' <summary>
    ''' Shows the static text in image viewer.
    ''' </summary>
    ''' <param name="viewer">An image viewer.</param>
    Public Shared Sub ShowStaticTextExample(viewer As Vintasoft.Imaging.Wpf.UI.WpfImageViewer)
        ' create the text overlay visual tool
        Dim textOverlayTool As New Vintasoft.Imaging.Wpf.UI.VisualTools.WpfTextOverlayTool()
                
        ' text anchor
        Dim textAnchor As Vintasoft.Imaging.UI.AnchorType = Vintasoft.Imaging.UI.AnchorType.Bottom Or Vintasoft.Imaging.UI.AnchorType.Left Or Vintasoft.Imaging.UI.AnchorType.Right Or Vintasoft.Imaging.UI.AnchorType.Top
                
        ' create the text overlay object
        Dim textOverlay As New Vintasoft.Imaging.Wpf.UI.VisualTools.WpfTextOverlay(textAnchor, "Text Overlay Example", New System.Windows.Media.Typeface("Arial"), 24, New System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 20, 200, 20)))
                
        ' add text overlay object to the text overlay collection of text overlay visual tool
        textOverlayTool.TextOverlayCollection.Add(textOverlay)
                
        ' set visual tool as the active visual tool of image viewer
        viewer.VisualTool = textOverlayTool
    End Sub
    /// <summary>
    /// Shows the static text in image viewer.
    /// </summary>
    /// <param name="viewer">An image viewer.</param>
    public static void ShowStaticTextExample(Vintasoft.Imaging.Wpf.UI.WpfImageViewer viewer)
    {
        // create the text overlay visual tool
        Vintasoft.Imaging.Wpf.UI.VisualTools.WpfTextOverlayTool textOverlayTool =
            new Vintasoft.Imaging.Wpf.UI.VisualTools.WpfTextOverlayTool();
                
        // text anchor
        Vintasoft.Imaging.UI.AnchorType textAnchor =
            Vintasoft.Imaging.UI.AnchorType.Bottom |
            Vintasoft.Imaging.UI.AnchorType.Left |
            Vintasoft.Imaging.UI.AnchorType.Right |
            Vintasoft.Imaging.UI.AnchorType.Top;
                
        // create the text overlay object
        Vintasoft.Imaging.Wpf.UI.VisualTools.WpfTextOverlay textOverlay =
            new Vintasoft.Imaging.Wpf.UI.VisualTools.WpfTextOverlay(
                textAnchor,
                "Text Overlay Example",
                new System.Windows.Media.Typeface("Arial"), 
                24, 
                new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 20, 200, 20)));
                
        // add text overlay object to the text overlay collection of text overlay visual tool
        textOverlayTool.TextOverlayCollection.Add(textOverlay);
                
        // set visual tool as the active visual tool of image viewer
        viewer.VisualTool = textOverlayTool;
    }
    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.Wpf.UI.VisualTools.UserInteraction.WpfUserInteractionVisualTool
                                  Vintasoft.Imaging.Wpf.UI.VisualTools.GraphicObjects.WpfGraphicObjectTool
                                     Vintasoft.Imaging.Wpf.UI.VisualTools.WpfTextOverlayTool

    Requirements

    Target Platforms: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also