AddCustomAnnot: OnCustomAnnotationPaint event not occurring

Discussions about annotation support.
Post Reply
Posts: 1
Joined: Thu Jul 18, 2019 2:52 pm

AddCustomAnnot: OnCustomAnnotationPaint event not occurring

Post by jannera » Thu Jul 18, 2019 3:00 pm


I'm trying to add a custom annotation on a PDF in a WPF application but OnCustomAnnotationPaint event never occurs so nothing gets drawn. I modified the sample application "Csharp-Annotations.WPF" to show this problem:

Code: Select all

        private void OpenFileCommand_Executed(object sender, ExecutedRoutedEventArgs e)
            GdViewer1.ZoomMode = ViewerZoomMode.ZoomModeFitToViewer;
            GdPictureStatus status = GdViewer1.DisplayFromFile("");
            if (status == GdPictureStatus.OK)

[b]                var annoManager = GdViewer1.GetAnnotationManager();
                var custom = annoManager.AddCustomAnnot(1, 1, 1, 1, 1);
                annoManager.OnCustomAnnotationPaint += AnnoManager_OnCustomAnnotationPaint;[/b]
                System.Windows.MessageBox.Show("Can not open file. Status: " + status.ToString());

        private void AnnoManager_OnCustomAnnotationPaint(GdPicture14.Annotations.AnnotationCustom Annot, System.Drawing.Graphics g)
            g.DrawRectangle(System.Drawing.Pens.Red, new System.Drawing.Rectangle(0, 0, 10, 10));

If I uncomment the ThumbnailEx1.LoadFromGdViewer row, then the event occurs but still nothing is drawn except on the thumbnail viewer. Here is an image of what happens:


Is there something wrong in the way I'm using AddCustomAnnot or is it broken?

Posts: 436
Joined: Wed Nov 22, 2017 9:52 am

Re: AddCustomAnnot: OnCustomAnnotationPaint event not occurring

Post by Gabriela » Thu Jul 18, 2019 4:06 pm


Here is the thread that can be useful:
Kind regards,

GdPicture Team

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests