/// <summary>
        /// Adds the annotation with comment.
        /// </summary>
        public void AddNewComment()
        {
            // get comment annotation image
            VintasoftImage image = DemosResourcesManager.GetResourceAsImage(
                "DemosCommonCode.Annotation.Comments.AnnotationCommentBuilder.CommentIcon.png");

            // create comment annotation data
            EmbeddedImageAnnotationData annotationData = new EmbeddedImageAnnotationData(image);
            Resolution resolution = _annotationVisualTool.ImageViewer.Image.Resolution;

            annotationData.Size = new SizeF(
                (float)UnitOfMeasureConverter.ConvertToDeviceIndependentPixels(image.Width, UnitOfMeasure.Pixels, resolution.Horizontal),
                (float)UnitOfMeasureConverter.ConvertToDeviceIndependentPixels(image.Height, UnitOfMeasure.Pixels, resolution.Vertical));
            annotationData.Border = false;

            // create comment
            annotationData.Comment      = new AnnotationComment(Color.Yellow, Environment.UserName);
            annotationData.Comment.Type = "Comment";

            // build annotation
            _annotationVisualTool.AnnotationBuildingFinished += AnnotationVisualTool_AnnotationBuildingFinished;
            RectangleAnnotationView view = (RectangleAnnotationView)_annotationVisualTool.AddAndBuildAnnotation(annotationData);

            view.Builder = new RectangularObjectMoveBuilder(view, annotationData.Size);
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BarcodeWriterTool"/> class.
        /// </summary>
        public BarcodeWriterTool()
        {
#if !REMOVE_BARCODE_SDK
            _writer = new BarcodeWriter();
            _writer.Settings.Changed    += new EventHandler(Settings_Changed);
            _writer.Settings.PixelFormat = BarcodeImagePixelFormat.Bgra32;
#endif

            base.Cursor       = System.Windows.Forms.Cursors.Cross;
            base.ActionCursor = base.Cursor;

            RectangularObjectTransformer transformer = new RectangularObjectTransformer(this);
            transformer.HideInteractionPointsWhenMoving = true;
            TransformController = transformer;

            // create the "Refresh barcode" button
            _refreshBarcodeButton       = new InteractionButton(this);
            _refreshBarcodeButton.Image = DemosResourcesManager.GetResourceAsImage(
                @"DemosCommonCode.Imaging.VisualTools.BarcodeWriterTool.Resources.RefreshBarcodeImage.png");
            // create the "Draw barcode" button
            _drawBarcodeButton       = new InteractionButton(this);
            _drawBarcodeButton.Image = DemosResourcesManager.GetResourceAsImage(
                @"DemosCommonCode.Imaging.VisualTools.BarcodeWriterTool.Resources.DrawBarcodeImage.png");
            // create the panel with buttons
            _controlButtonsPanel              = new InteractionButtonsPanel(this, _refreshBarcodeButton, _drawBarcodeButton);
            _controlButtonsPanel.Interaction += new EventHandler <InteractionEventArgs>(ControlButtonsPanel_Interaction);
        }