예제 #1
0
        private void toolStripBtnFill_Click(object sender, EventArgs e)
        {
            Color color = SelectColor();

            if (color != Color.Transparent)
            {
                toolStripBtnFill.BackColor = color;

                List <AnnotationData> aryAnnotation = new List <AnnotationData>();
                dynamicDotNetTwain1.GetSelectedAnnotationList(dynamicDotNetTwain1.CurrentImageIndexInBuffer, out aryAnnotation);
                foreach (AnnotationData annotation in aryAnnotation)
                {
                    DWTAnnotationType type = annotation.GetAnnotationType();
                    if (type == DWTAnnotationType.enumRectangle)
                    {
                        RectangleAnnotationData oldAnnotation = ((RectangleAnnotationData)annotation);
                        RectangleAnnotationData newAnnotation = new RectangleAnnotationData(oldAnnotation.AnnotationLocation, oldAnnotation.AnnotationSize,
                                                                                            color, oldAnnotation.PenColor, oldAnnotation.PenWidth, oldAnnotation.Name, oldAnnotation.UserName, oldAnnotation.Description,
                                                                                            oldAnnotation.CreationTime, oldAnnotation.ModifiedTime, oldAnnotation.Selected);
                        dynamicDotNetTwain1.UpdateAnnotation(dynamicDotNetTwain1.CurrentImageIndexInBuffer, oldAnnotation, newAnnotation);
                    }
                    else if (type == DWTAnnotationType.enumEllipse)
                    {
                        EllipseAnnotationData oldAnnotation = ((EllipseAnnotationData)annotation);
                        EllipseAnnotationData newAnnotation = new EllipseAnnotationData(oldAnnotation.AnnotationLocation, oldAnnotation.AnnotationSize,
                                                                                        color, oldAnnotation.PenColor, oldAnnotation.PenWidth, oldAnnotation.Name, oldAnnotation.UserName, oldAnnotation.Description,
                                                                                        oldAnnotation.CreationTime, oldAnnotation.ModifiedTime, oldAnnotation.Selected);
                        dynamicDotNetTwain1.UpdateAnnotation(dynamicDotNetTwain1.CurrentImageIndexInBuffer, oldAnnotation, newAnnotation);
                    }
                }
            }
        }
예제 #2
0
        private void toolStripCbxPen_TextChanged(object sender, EventArgs e)
        {
            List <AnnotationData> aryAnnotation = new List <AnnotationData>();

            dynamicDotNetTwain1.GetSelectedAnnotationList(dynamicDotNetTwain1.CurrentImageIndexInBuffer, out aryAnnotation);
            foreach (AnnotationData annotation in aryAnnotation)
            {
                DWTAnnotationType type = annotation.GetAnnotationType();
                if (type == DWTAnnotationType.enumRectangle)
                {
                    RectangleAnnotationData oldAnnotation = ((RectangleAnnotationData)annotation);
                    RectangleAnnotationData newAnnotation = new RectangleAnnotationData(oldAnnotation.AnnotationLocation, oldAnnotation.AnnotationSize,
                                                                                        oldAnnotation.FillColor, oldAnnotation.PenColor, int.Parse(toolStripCbxPen.Text), oldAnnotation.Name, oldAnnotation.UserName, oldAnnotation.Description,
                                                                                        oldAnnotation.CreationTime, oldAnnotation.ModifiedTime, oldAnnotation.Selected);
                    dynamicDotNetTwain1.UpdateAnnotation(dynamicDotNetTwain1.CurrentImageIndexInBuffer, oldAnnotation, newAnnotation);
                }
                else if (type == DWTAnnotationType.enumEllipse)
                {
                    EllipseAnnotationData oldAnnotation = ((EllipseAnnotationData)annotation);
                    EllipseAnnotationData newAnnotation = new EllipseAnnotationData(oldAnnotation.AnnotationLocation, oldAnnotation.AnnotationSize,
                                                                                    oldAnnotation.FillColor, oldAnnotation.PenColor, int.Parse(toolStripCbxPen.Text), oldAnnotation.Name, oldAnnotation.UserName, oldAnnotation.Description,
                                                                                    oldAnnotation.CreationTime, oldAnnotation.ModifiedTime, oldAnnotation.Selected);
                    dynamicDotNetTwain1.UpdateAnnotation(dynamicDotNetTwain1.CurrentImageIndexInBuffer, oldAnnotation, newAnnotation);
                }
                else if (type == DWTAnnotationType.enumLine)
                {
                    LineAnnotationData oldAnnotation = ((LineAnnotationData)annotation);
                    LineAnnotationData newAnnotation = new LineAnnotationData(oldAnnotation.StartPoint, oldAnnotation.EndPoint,
                                                                              oldAnnotation.PenColor, int.Parse(toolStripCbxPen.Text), oldAnnotation.Name, oldAnnotation.UserName, oldAnnotation.Description,
                                                                              oldAnnotation.CreationTime, oldAnnotation.ModifiedTime, oldAnnotation.Selected);
                    dynamicDotNetTwain1.UpdateAnnotation(dynamicDotNetTwain1.CurrentImageIndexInBuffer, oldAnnotation, newAnnotation);
                }
            }
        }
예제 #3
0
        private void ellipseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            EllipseAnnotationData EAnnotation = new EllipseAnnotationData();

            EAnnotation.AnnotationLocation = new Point(300, 300);
            EAnnotation.AnnotationSize     = new Size(80, 140);
            EAnnotation.FillColor          = Color.Blue;
            EAnnotation.PenColor           = Color.Black;
            EAnnotation.PenWidth           = 2;
            EAnnotation.Description        = "Create an ellipse annotation.";
            this.dynamicDotNetTwain1.CreateAnnotation(this.dynamicDotNetTwain1.CurrentImageIndexInBuffer, EAnnotation);
        }