Page 1 of 1

How do I Cancel an Interactive Annotation? C#

Posted: Mon Jan 13, 2020 9:42 pm
by ajs
How do I programmatically Cancel an Interactive Annotation?

Scenario:
1. User clicks an Annotate button, for example Freehand.
This executes code like: GdView.AddFreeHandAnnotInteractive(Color.Black, myPenWidth, System.Drawing.Drawing2D.LineCap.Flat, System.Drawing.Drawing2D.LineCap.Flat, 1, false);

2. User changes her mind, without clicking in the GdView, and wants to use Text annotation instead. However, the next AddTextAnnotInteractive() process does not cancel the previous AddFreeHandAnnotInteractive() process, so when the user clicks to add Text, the result is FreeHand capture.

My current work-around is to toggle the GdViewer.SetAnnotationEditorMode() just prior to Add*AnnotInteractive code; like the following:

Code: Select all

// there must be a better way to cancel the previous incomplete Add*AnnotInteractive()
GdViewer.SetAnnotationEditorMode(false);
GdViewer.SetAnnotationEditorMode(true);
GdViewer.Add*AnnotInteractive(...);

Re: How do I Cancel an Interactive Annotation? C#

Posted: Wed Jan 15, 2020 4:09 am
by Loïc

Re: How do I Cancel an Interactive Annotation? C#

Posted: Thu Jan 16, 2020 3:39 pm
by ajs
CancelLastAnnotInteractiveAdd();

Works for me. Thank you!

Re: How do I Cancel an Interactive Annotation? C#

Posted: Thu Jan 16, 2020 3:44 pm
by Loïc
You're very welcome! Thanks a lot for the return.