Page 1 of 1

WinForms: Disable the text box in stamp annotation.

Posted: Fri Aug 04, 2017 10:43 am
by Alex
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()

        private void button1_Click(object sender, EventArgs e)
            // add image to the viewer

            // 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