WinForms: Disable the text box in stamp annotation.

Code samples for VintaSoft Annotation .NET Plug-in. Here you can request a code sample.

Moderator: Alex

Post Reply
Alex
Site Admin
Posts: 1431
Joined: Thu Jul 10, 2008 2:21 pm

WinForms: Disable the text box in stamp annotation.

Post by Alex » Fri Aug 04, 2017 10:43 am

By default the stamp annotation shows the text box for editing the annotation text when mouse is double clicked on annotation. The simplest way for disabling the text editing using the text box is to change the annotation transformer.

Here is an example for WinForms that shows how to create the stamp annotation with disabled text editing:

Code: Select all

using System;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            // add image to the viewer
            annotationViewer1.Images.Add("320155_1886.jpg");

            // create the stamp annotation data
            Vintasoft.Imaging.Annotation.StampAnnotationData stampAnnotationData = new Vintasoft.Imaging.Annotation.StampAnnotationData();
            // set the annotation text
            stampAnnotationData.Text = "Approved!";

            // create the stamp annotation view
            Vintasoft.Imaging.Annotation.UI.StampAnnotationView stampAnnotationView = new Vintasoft.Imaging.Annotation.UI.StampAnnotationView(stampAnnotationData);
            // change the Vintasoft.Imaging.Annotation.UI.VisualTools.UserInteraction.RectangularTextAnnotationTransformer to
            // the Vintasoft.Imaging.Annotation.UI.VisualTools.UserInteraction.RectangularAnnotationTransformer -
            // new transformer will not show text box when mouse is double cliked on annotation
            stampAnnotationView.Transformer = new Vintasoft.Imaging.Annotation.UI.VisualTools.UserInteraction.RectangularAnnotationTransformer(stampAnnotationView);

            // add annotation to the image in viewer and build the annotation
            annotationViewer1.AddAndBuildAnnotation(stampAnnotationView);
        }
    }
}

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest