Is is possible to close a popup in code?

In our software, we use the different annotation tools to let users draw shapes and lines on the .pdf files. When I draw an oval with the oval tool, switch to the pan tool, and double click on my oval annotation, a sticky note popup appears. Leaving this open while modifying the doc and switching pages is causing some problems with displaying the correct page. What I want to do is somehow close this sticky note if we attempt a risky behavior, but I can’t seem to figure out how to close it using C#.
I’ve tried using it’s Dispose() method, and using AnnotRemove(), but once it gets removed, it’s still on the screen and messes things up. Is there any way to close this .pdf.


Hi Tommy,

we have a variety of viewers that are available in C#. Our WinForms PDFViewCtrl available for .Net 1.0+. A WPF version for .Net 4+. Plus WinRT and WinPhone8 versions.

The solution should be (nearly) the same for all, but just to keep things simple, can you please clarify which one you are using?


Thanks for the response, I’ll try to do a better job of explaining my predicament.

I’m using PDFViewZoomCtrl. Mainly, I just can’t seem to do anything in code that affects sticky notes.I’m using the following method to handle double click events inside of a class that inherits PDFViewZoomCtrl.

public partial class MaxViewer : PDFViewZoomCtrl
//other properties and methods . . .

protected override void OnMouseDoubleClick(MouseEventArgs e)

base.OnMouseDoubleClick(e); //creates a sticky note popup when clicking on a circle annotation
int numAnnots = THISPAGE.GetNumAnnots();
for (int i = 0; i < numAnnots; i++)
Annot annot = THISPAGE.GetAnnot(i);
if (!annot.IsValid()) continue;
if (annot.GetType() == Annot.Type.e_Circle)
Circle circle = new Circle(annot); //this should be the circle that was clicked on
Popup pop = circle.GetPopup(); //this should the resulting popup
pop.SetRect(new Rect(100,100,400,400)); // I want to relocate the popup

if (pop.IsOpen()) pop.SetOpen(false); // and I want to close it

The sticky note popup still stays open, though, and it doesn’t move. I have checked to make sure circle and pop are the correct annotations, and not new instances. I have also checked to make sure the variables are getting set, and they are. I am literally out of ideas. I have tried manually creating a sticky note popup using Popup.Create(…) and adding it to the page with AnnotPushBack() and with AnnotPushFront(), but then it doesn’t show up even after Update() and UpdatePageLayout().