private void textToolStripMenuItem_Click(object sender, EventArgs e) { TextAnnotationData TAnnotation = new TextAnnotationData(); TAnnotation.AnnotationLocation = new Point(80, 80); TAnnotation.AnnotationSize = new Size(200, 200); TAnnotation.TextFont = new Font("", 20); TAnnotation.TextContent = "Dynamsoft"; TAnnotation.TextColor = Color.Brown; TAnnotation.Description = "Create a text annotation"; this.dynamicDotNetTwain1.CreateAnnotation(this.dynamicDotNetTwain1.CurrentImageIndexInBuffer, TAnnotation); }
private void toolStripCbxFont_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.enumText) { TextAnnotationData oldAnnotation = ((TextAnnotationData)annotation); TextAnnotationData newAnnotation = new TextAnnotationData(oldAnnotation.AnnotationLocation, oldAnnotation.AnnotationSize, new Font("", float.Parse(toolStripCbxFont.Text)), oldAnnotation.TextColor, oldAnnotation.TextContent, oldAnnotation.TextRotate, oldAnnotation.Name, oldAnnotation.UserName, oldAnnotation.Description, oldAnnotation.CreationTime, oldAnnotation.ModifiedTime, oldAnnotation.Selected); dynamicDotNetTwain1.UpdateAnnotation(dynamicDotNetTwain1.CurrentImageIndexInBuffer, oldAnnotation, newAnnotation); } } }
private void toolStripBtnFont_Click(object sender, EventArgs e) { Color color = SelectColor(); if (color != Color.Transparent) { toolStripBtnFont.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.enumText) { TextAnnotationData oldAnnotation = ((TextAnnotationData)annotation); TextAnnotationData newAnnotation = new TextAnnotationData(oldAnnotation.AnnotationLocation, oldAnnotation.AnnotationSize, oldAnnotation.TextFont, color, oldAnnotation.TextContent, oldAnnotation.TextRotate, oldAnnotation.Name, oldAnnotation.UserName, oldAnnotation.Description, oldAnnotation.CreationTime, oldAnnotation.ModifiedTime, oldAnnotation.Selected); dynamicDotNetTwain1.UpdateAnnotation(dynamicDotNetTwain1.CurrentImageIndexInBuffer, oldAnnotation, newAnnotation); } } } }