Reference Guide
GdPicture14 Namespace / GdViewer Class / BeforeAnnotationAddedByUser Event

In This Topic
    BeforeAnnotationAddedByUser Event (GdViewer)
    In This Topic
    This event is raised right before a new GdPicture/XMP annotation is to be added by a user. This event occurs in the mouse down action, therefore it allows you to change some properties of the newly added annotation before rendering it on the screen.

    Please check the corresponded GdViewer.BeforeAnnotationAddedByUserEventHandler for given parameters.

    Public Event BeforeAnnotationAddedByUser As GdViewer.BeforeAnnotationAddedByUserEventHandler
    public event GdViewer.BeforeAnnotationAddedByUserEventHandler BeforeAnnotationAddedByUser
    public event BeforeAnnotationAddedByUser: GdViewer.BeforeAnnotationAddedByUserEventHandler; 
    In JScript, you can handle the events defined by another class, but you cannot define your own.
    public: __event GdViewer.BeforeAnnotationAddedByUserEventHandler* BeforeAnnotationAddedByUser
    event GdViewer.BeforeAnnotationAddedByUserEventHandler^ BeforeAnnotationAddedByUser
    Be aware, that this event only handles GdPicture/XMP annotations.
    How to add this event to your GdViewer control. This example shows you how to address the annotation before adding it to change its properties.
    'We assume that the GdViewer1 control has been properly integrated.
    Friend WithEvents GdViewer1 As GdPicture14.GdViewer
    'Add the event.
    AddHandler GdViewer1.BeforeAnnotationAddedByUser, AddressOf GdViewer1_BeforeAnnotationAddedByUser
    'Define the event.
    Sub GdViewer1_BeforeAnnotationAddedByUser(ByVal AnnotationIdx As Integer) Handles GdViewer1.BeforeAnnotationAddedByUser
        Dim annot As GdPicture14.Annotations.Annotation = GdViewer1.GetAnnotationFromIdx(AnnotationIdx)
        If TypeOf annot Is GdPicture14.Annotations.AnnotationStickyNote Then
            CType(annot, GdPicture14.Annotations.AnnotationStickyNote).FillColor = Color.Beige
        End If
    End Sub
    //We assume that the GdViewer1 control has been properly integrated.
    //Add the event.
    GdViewer1.BeforeAnnotationAddedByUser += GdViewer1_BeforeAnnotationAddedByUser;
    //Define the event.
    void GdViewer1_BeforeAnnotationAddedByUser(int AnnotationIdx)
        GdPicture14.Annotations.Annotation annot = GdViewer1.GetAnnotationFromIdx(AnnotationIdx);
        if (annot is GdPicture14.Annotations.AnnotationStickyNote)
            ((GdPicture14.Annotations.AnnotationStickyNote)annot).FillColor = Color.Beige;
    See Also