How do I Cancel an Interactive Annotation? C#

Discussions about annotation support.
Post Reply
ajs
Posts: 3
Joined: Mon Jan 13, 2020 7:26 pm

How do I Cancel an Interactive Annotation? C#

Post by ajs » Mon Jan 13, 2020 9:42 pm

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(...);

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

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

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


ajs
Posts: 3
Joined: Mon Jan 13, 2020 7:26 pm

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

Post by ajs » Thu Jan 16, 2020 3:39 pm

CancelLastAnnotInteractiveAdd();

Works for me. Thank you!

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

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

Post by Loïc » Thu Jan 16, 2020 3:44 pm

You're very welcome! Thanks a lot for the return.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest